Can I disable SOP (Same Origin Policy) on any browser for development? Can I disable SOP (Same Origin Policy) on any browser for development? javascript javascript

Can I disable SOP (Same Origin Policy) on any browser for development?


UPDATE 6/2012: This used to work at the time of the writing, but obviously no more. Sorry.

In Firefox (might apply to other Gecko-based browsers as well) you can use the following JavaScript snippet to allow cross-domain calls:

if (navigator.userAgent.indexOf("Firefox") != -1) {    try {        netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");    }     catch (e) {        alert("Permission UniversalBrowserRead denied -- not running Mozilla?");    }}

It looks like there's an issue created in the Chromium issue tracker for achieving the same functionality, so you could try starting Chrome with the argument --disable-web-security. I don't know which builds this works on exactly, but at least Nokia's WRT Tools comes with a Chrome installation that does in fact allow loading content from other sites.


Unfortunately, using the following:

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

has been disabled in Firefox 5.

https://bugzilla.mozilla.org/show_bug.cgi?id=667312


Make a page on your local server that calls the remote server and answer the same as the remote server.

Example, javascript calls local server for a JSON. The local server makes the call to the remote server for that JSON. The local server receives the JSON from the remote server and send it to the javascript.