开发者

Local PHP Proxy

开发者 https://www.devze.com 2023-03-29 04:44 出处:网络
I\'m developing a Javascript application that fetches and manipulat开发者_开发问答es a large quantity of XML documents. This script is meant to be run locally, from the user\'s computer.

I'm developing a Javascript application that fetches and manipulat开发者_开发问答es a large quantity of XML documents. This script is meant to be run locally, from the user's computer.

Enter Same-Origin Policy.

I'v looked at quite a few options to get around this barrier, but none of them seem practical in this situation. I originality dismissed a PHP proxy, since the JS is local. But now I'm wondering if it's possible to run the requests through a PHP proxy on the user's computer, thus bypassing cross-domain restrictions.

Is there any way to do this or something similar?


If you are running a javascript file using the file protocol (file:///), some browsers will allow cross-domain requests.

This is because browsers assume things originating from a local computer will be 100% completely trusted.

You can run a php proxy but that requires an application server, and php interpreter to be installed.


Google for "crossdomain ajax". For example, first results for me: http://usejquery.com/posts/9/the-jquery-cross-domain-ajax-guide and http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html

0

精彩评论

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

关注公众号