Bennysce
Bennysce

Reputation: 43

javascript redirect only works in IE after showing the IE dev console

I came across the weirdest bug. All i wanted to do is send a form using jquery and in the callback redirect the user to another page, like:

window.location.href = "index.php?p=admin";

Which from what i can find should work in all browsers.

And it does, except in IE8/9 where it only does that after i hit F12 to show the dev console! After that i need to close the browser for the redirect to NOT work again.

Anyone know why this happens and know a better way to redirect to another local page using javascript that works in IE without being affected by this crazy bug?

Upvotes: 2

Views: 1014

Answers (2)

splitfeed
splitfeed

Reputation: 94

Are you using any of the console. functions? They aren't defined until showing the dev console and will stop the script from executing.

Upvotes: 3

S Philp
S Philp

Reputation: 452

Have you tried?

window.location.replace("index.php?p=admin");

Upvotes: 0

Related Questions