Cross domain Ajax request from within js file

后端 未结 7 2129
清酒与你
清酒与你 2020-11-30 10:17

Here\'s the problem:

1.) We have page here... www.blah.com/mypage.html

2.) That page requests a js file www.foo.com like this...



        
7条回答
  •  悲&欢浪女
    2020-11-30 11:02

    For cross domain hits this is a good working example and now is considered as some what "standard" http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html.

    there are other ways as well, for eg injecting iframes with document.domain altered

    http://fettig.net/weblog/2005/11/28/how-to-make-xmlhttprequest-connections-to-another-server-in-your-domain/

    I still agre that the easy way is calling a proxy in same domain but then it's not truly client side WS call.

提交回复
热议问题