IE 6 bug in window.location

There is a bug in IE 6 where following code does not work

var newUrl = "http://www.google.com/";
window.location = newUrl;
// This also doesn't work!
// window.location.href = newUrl;

After a scratching head for couple of hours, found the solution here

var newUrl = "http://google.com/";
setTimeout(function()
{
window.location = newUrl;
}, 0);

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.