The code you've provided should function correctly, with just a few small errors to correct:
Make sure to include the "e" in setTimeout
Instead of using document.location
, switch to window.location
.
I tested this on IE8 and it worked as expected. If you are running this within an event that triggers a page reload, such as a form's submit
event, be sure to prevent the default action from happening. How you handle this will vary based on how you're binding the event (e.g., use return false;
for DOM0 onsubmit="..."
handlers, event.preventDefault()
for more modern methods, or consult the documentation if using jQuery, Prototype, etc.).
Although your current approach works, it's generally recommended to use a separate function instead of inline code, like so:
setTimeout(function() {
window.location.href = 'new_page.html';
}, 1000);
However, both methods should achieve the desired result.