Why doesn't jquery .load() load a text file from an external website?

自古美人都是妖i 提交于 2019-12-01 02:10:15

Clientaccesspolicy has no affect on javascript. Most (maybe all?) modern browsers will prevent you from running cross-site-scripting, as it is a security risk.

Your alternative is to proxy that site through a file on your own site, like /proxy.php?loadurl=http://theothersite.com and then call that file via the Javascript, which would be allowed since it is from your domain.

I don't think any browser obeys clientaccesspolicy.xml or crossdomain.xml for XMLHttpRequest.

There are other mechanisms you can look at, such as Cross-Origin Resource Sharing. This is supported by Firefox 3.5 and later.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!