开发者

AJAX XMLHttpRequest POST X-Domain

I am sending an AJAX request using POST over X-Domain for a widget we are producing for our website. The problem we are facing is that t开发者_开发百科his is getting blocked.

My question is - for "modern browsers" [Chrome, Safari, FF, IE8] - it is my understanding that setting "Access-Control" headers

Access-Control-Allow-Origin: http://www.test.com
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: *
Access-Control-Max-Age: 1728000

Will allow these "POST" requests to work ? But for IE7 we need to implement some "custom" JSONP solution?

Am I correct in this ? Anyone ?


This works but not using the standard XmlHttpRequest object. For example in IE8 you should use the XDomainRequest object to send the request. For these scenarios, JSONP is actually easier to use and works cross-browser as implemented in jQuery.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜