在没有服务器端、silverlight、DBC 等的 SharePoint Intranet 上处理跨域的最佳方法 [英] Best way to handle Cross Domain on SharePoint Intranet w/o server side, silverlight, DBC etc
问题描述
我在 Microsoft 内部 SharePoint 网站上工作,我需要从跨域 SharePoint 网站中提取列表数据.
I'm working on a Microsoft internal SharePoint site, and I need to pull in List data from a cross domain SharePoint site.
由于种种原因,我不想使用 Silverlight,而且目前无法进行业务数据连接.
I don't want to use Silverlight, for various reasons, and Business Data Connectivity is not possible right now.
是否有一种简单的方法可以使用 JavaScript 或类似的方法来完成此操作?
Is there a simple way to use JavaScript or something like it to accomplish this?
推荐答案
"简单?"不完全是.鉴于您的要求,特别是无服务器端",这是不可能的.
"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.
体面的支持跨源资源共享,用于 XMLHttpRequest
和 Microsoft 的 XDomainRequest
.不过,这将要求远程服务器在响应中包含正确的标头,以允许您的源/域发出请求.
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
一个常见的选项是JSONP,它在