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?
The window. location is read/write on all compliant browsers.
window. location is an object that holds all the information about the current document location (host, href, port, protocol etc.). location. href is shorthand for window.
The href property of the Location interface is a stringifier that returns a string containing the whole URL, and allows the href to be updated.
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:
http://yourdomain.com/this/is/a/very/long/path.php
... 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:
http://yourdomain.com/this/is/a/very/long/path.php
But if you put a leading slash, /test.php, then the location becomes this:
http://yourdomain.com/test.php
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With