Reputation: 617
I am using Jquery Ajax for login form.After ajax success,I redirect the page using window.location.href="test.php"
This is working fine in Chrome,firefox and also in IE9.But in IE 11,it is not working.
I have tried,
window.location.replace("test.php");
window.location.assign("test.php");
setTimeout('window.navigate("test.php");', 1);
window.open('test.php','_self', null , false);
But all fails.Can anyone help?
Upvotes: 7
Views: 28449
Reputation: 1433
I resolved this problem like this:
window.location.replace("test.php");
I would recommend location.assign("url")
or location.replace("url")
instead of location.href = url
.
Upvotes: 0
Reputation: 1235
Try adding a leading slash:
window.location.assign('/test.php');
Explanation
Whenever setting the location, it works very similar to clicking a hyperlink on the same page. So let's say you're at a location like this:
... and then you try to navigate away from this page with any of the following mechanisms without a leading slash:
<a href="test.php">Test Page</a>
window.location = "test.php";
window.location.href = "test.php";
window.location.assign("test.php");
window.location.replace("test.php");
window.history.pushState("Test Page", {}, "test.php");
... you will notice the URL become this:
But if you put a leading slash, /test.php, then the location becomes this:
Upvotes: 7
Reputation: 617
Regarding session storage, you have to make settings as follows,
Go to Tools->Internet Options and click Privacy Tab and select Advanced and in that window,check the box Override Automatic Cookie handling and Always allow Session cookies check box.
It will work.It works for me fine.
Regards,
Rekha
Upvotes: 4
Reputation: 74738
You can use document.location
instead, it works in IE11 as per this answer.
document.location.href = "test.php";
Upvotes: 1