Michael
Michael

Reputation: 51

What Browsers Allow Cross-Origin XMLHttpRequest From Local Files?

I know Internet Explorer 8 allows cross-domain XHR from LOCAL files, but what about other browsers? I'd like to know about what versions/OS this will work on (if any) for each of the major 5 browsers. Please include any workarounds like Chrome's --disable-web-security flag.

Thanks!

Upvotes: 1

Views: 2841

Answers (2)

Max
Max

Reputation: 1552

In Safari you can enable the Develop menu (Safari → Preferences → Advanced → Show Develop menu in menu bar). There you can disable cross-origin restrictions (Develop → Disable Cross-Origin Restrictions).

Upvotes: 0

Baz1nga
Baz1nga

Reputation: 15579

well here is a nice blog abt cross domain requests: http://caffeinelab.net/2011/02/08/cross-domain-requests-state-of-the-browsers/

IE provides access control to do cross-domain requests. Now the bad news: as usual, IE can’t do like the others and they have their own non-standard way to provide it.

Instead of a regular XMLHttpRequest, you need to do a XDomainRequest! Moreover, it works only for public pages, not for authenticated pages. So if you need to send he cookies and you want your application to work in IE, you’re pretty much screwed.

and here is how you do it in FFX: http://dirolf.com/2007/06/enabling-cross-domain-ajax-in-firefox.html

Not sure about safari, but Chrome has a command line switch for this:

chrome.exe --disable-web-security

Keep in mind when you enable this you are risking your security when you visit other sites. so be careful

hope this helps

Upvotes: 1

Related Questions