google chrome - Cross-origin redirect with XHR -


i try realize following scenario:

  • load page origin a.com
  • start synchronous xhr request script on page resource on same origin a.com
  • this request answered 302-redirect resource on origin b.com

i expect cross-origin redirect processed, instead error returned xhr-send method , no request nor preflight request triggered.

  • chrome (26): error message 'network_err: xmlhttprequest exception 101'
  • firefox (20): error message [exception... "failure" nsresult: "0x80004005 (ns_error_failure)" ...
  • ie9: no error message xhr send() returns status=12017

according xhr specification have expected redirect works cross-origin.

any idea how cross-origin redirect running?

that won't work because redirect handled browser , xhr sees page browser got redirected to—which means is cross domain—which means fail unless b.com explicitly allows a.com domain access it.

you can have other page on a.com act proxy , download content on b.com , output response got back.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -