IE 6 bug in window.location

January 13, 2010 · Posted in general web, Windoze · Comment 

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);