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

前端 未结 2 754

In the example below, when I click the button, it says \"Load was performed\" but no text is shown.

I have a clientaccesspolicy.xml

2条回答
  •  独厮守ぢ
    2021-01-07 12:36

    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.

提交回复
热议问题