开发者

Overcoming Cross-Domain issues

开发者 https://www.devze.com 2023-02-20 02:54 出处:网络
Are there any ways to overcome the cross domain issues that occur when attempting to retrieve data client-side from another web server in开发者_开发技巧 violation of the Same Origin policy?http://en.w

Are there any ways to overcome the cross domain issues that occur when attempting to retrieve data client-side from another web server in开发者_开发技巧 violation of the Same Origin policy?


http://en.wikipedia.org/wiki/JSONP

http://api.jquery.com/jQuery.getJSON/#jsonp


Instead of referencing a third party domain directly from the client, call up to your hosting domain and have the server retrieve whatever you're getting from the third party domain.


I concur with Greg D, it is easy enough to make an AJAX call to a script on your domain that uses curl to fetch a resource from another domain. Just remember that you will most likely want to cache the fetched file on your server so you don't have to go get it every single time a page is viewed.

0

精彩评论

暂无评论...
验证码 换一张
取 消