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?
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:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments