window.location not working in IE 6
For some unknown reason, IE 6 Java-script engine doesn’t allow me to a new URL by simply changing the window.location or window.location.href properties.
The very same thing is working fine in IE 7/8, Chrome and Fire-fox. But IE 6 is doing nothing on a call like window.location.href = url; No error is returned and location of page remains the same.
On searching for this issue, i came to following solution.
This problem is resolved by replacing the direct java-script to a custom function call like:
function SetWindowLocation(url)
{
setTimeout(function()
{
window.location = url;
}, 0);
}
Calling this function will change the location in all browsers including the funny IE 6.
Advertisement
Categories: Javascript
IE 6, Javascript