Navigate with location.href during XMLHttpRequest asynchronous call

Posted by OlduwanSteve on Stack Overflow See other posts from Stack Overflow or by OlduwanSteve
Published on 2010-04-16T15:18:09Z Indexed on 2010/04/16 17:43 UTC
Read the original article Hit count: 251

I have a web page containing something like this:

<div onclick="location.href = 'AnotherPage';">

This page also uses asynchronous XMLHttpRequests for some ajax updating.

I have found that while an asynchronous XMLHttpRequest is in progress, clicking on this div does not load the new page. If I cancel my request first then it works fine. This seems wrong, but I cannot find any documentation that describes what should happen.

So the question is: what should happen to asynchronous XMLHttpRequests in progress when a new page is loaded using location.href?

© Stack Overflow or respective owner

Related posts about xmlhttprequest

Related posts about JavaScript