Domanda

I want to do a PUT request across a different domain. But the script fails only in IE.

I figured out what the problem was, in IE if you look at Internet Options > Security tab > Custom level > Miscellaneous > Access data sources across domains option was set to disable. The only way I was able to get my put request work is setting that option to Allow.

So my question: Is there a way I can get this working without enforcing end users to set the option?

There is XDomainRequest() which can be used for XDomain requests in IE but, this method doesn't support PUT.

È stato utile?

Soluzione

IE9 and older does not support PUT method in cross domain request. Only GET and POST.

Altri suggerimenti

You could use a library like Xdomain or EasyXDM to get a CORS alternative using the Post Message hack.

I prefer to use Xdomain because it hijacks the native XMLHTTPRequest and provides a "drop-in" solution. EasyXDM forces you to use their API which means more conditional coding overhead, however, it supports IE6/IE7.

The main take away? Don't stop supporting CORS! Just make IE behave itself and opt-in to the future.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top