I'm trying to understand what is the chronology of events after an assignment to location.href takes place. It seems that the assignment itself does not stop executing current js call stack, and therefore one can attempt multiple assignments in a row. What is the semantic of such a code :
<!doctype html>
<script>
var h=location.href;
location.href="http://google.com";
location.href=h+"#ok";
</script>
Is it guaranteed that the browser will perform two HTTP GETs? Is it guaranteed that they will be in sequential order? Will the browser wait till the execution stack ends? Will both assignments cause two separate 'onblur' events? I've noticed that in Chrome my above example causes the broswer to display for a short period "vanisoft.pl/~lopuszanski/public/redirect_test.html" in the address bar followed by redirect to google, but if I change the last line to be:
location.href=h;
then there is an infinite loop.
The question is quite pragmatic in situation where there more than one piece of js which can affect the routing in a single page app for example.