Archive

Posts Tagged ‘IE 6’

window.location not working in IE 6

October 21, 2010 Leave a comment

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.

Advertisements
Categories: Javascript Tags: ,