admin 管理员组文章数量: 1184232
I'm working on a Microsoft internal SharePoint site, and I need to pull in List data from a cross domain SharePoint site.
I don't want to use Silverlight, for various reasons, and Business Data Connectivity is not possible right now.
Is there a simple way to use JavaScript or something like it to acplish this?
I'm working on a Microsoft internal SharePoint site, and I need to pull in List data from a cross domain SharePoint site.
I don't want to use Silverlight, for various reasons, and Business Data Connectivity is not possible right now.
Is there a simple way to use JavaScript or something like it to acplish this?
Share Improve this question asked Oct 24, 2011 at 17:25 WesleyWesley 5,6219 gold badges46 silver badges72 bronze badges2 Answers
Reset to default 10"Simple?" Not exactly. Given your requirements, particularly "w/o server side," this isn't possible.
However, if you can forego that requirement, you have a few options for enabling cross-domain requests.
CORS
There's decent support for Cross-Origin Resource Sharing for XMLHttpRequest and Microsoft's XDomainRequest. Though, this will require that the remote server include the proper headers in the response to allow your origin/domain to make the request.
<% Response.AddHeader("Access-Control-Allow-Origin", "*") %>
JSONP
A mon option is JSONP, which loads the resource in a <script> with a callback parameter with the name of a global function. Since JSON is based on JavaScript literals, this won't have the same browser-support issues, but the remote server will have to know how to construct the output and it's limited to GET requests.
// <script src="http://other.dom/resource?callback=loadResource"></script>
loadResource( [ {"id": 1, "name": "foo"}, {"id": 2, "name": "bar"} ] );
Server-side Proxy
If the remote server you're requesting from can't (or won't) be adjusted to support cross-domain requests, you're pretty much left with making a Server-Side Proxy on your server.
The general pattern is described at AjaxPatters and a number of .NET implementations can be found, including John Chapman's and the Cross-Domain Proxy project.
You can use JQuery to get data from a SharePoint list. See this article.
本文标签:
版权声明:本文标题:javascript - Best way to handle Cross Domain on SharePoint Intranet wo server side, silverlight, DBC etc - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1741195628a2272822.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论