window.location.href not working in IE 11

rekha s

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?

Med.Amine.Touil

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

window.location.href not working on IE

From Dev

window.location.href not working

From Dev

Javascript window.location.href onClick not working

From Dev

$window.location.href NOT WORKING in AngularJS

From Dev

JavaScript window.location.href not working in localhost

From Dev

window.location.href and hash are not working on chrome

From Dev

Javascript window.location.href onClick not working

From Dev

window.location.href not working as expected

From Dev

`window.location.href` not working as intended

From Dev

window.location.href isn't working

From Dev

*ngIf window.location.href.indexOf is not working

From Dev

window.open() not working in IE11

From Dev

IE11 not able to get the the current URL using document.location.href OR $(location).attr("href")

From Dev

Redirect a Website to a local folder Using window.location.href() not working

From Dev

window.location.href not working, mod rewrite or jquery?

From Dev

preventDefault stops window.location.href from working

From Dev

window.location.href not working after Response.End()

From Dev

location.href not working

From Dev

Object.defineProperty not working on window object IE11

From Dev

Setting window.location or window.open in AngularJS gives "access is denied" in IE 11

From Dev

String is not a function on window location href

From Dev

window.location = '' is not working ;

From Dev

window location not working javascript

From Dev

IE 11 + SignalR not working

From Dev

calc not working ie 11

From Dev

jQuery not working with IE 11

From Dev

css not working in IE 11

From Dev

Setting window.location with &copy anywhere in the URL changes to © in IE11?

From Dev

angular4 unit test for window.location.href redirect to external link not working

Related Related

  1. 1

    window.location.href not working on IE

  2. 2

    window.location.href not working

  3. 3

    Javascript window.location.href onClick not working

  4. 4

    $window.location.href NOT WORKING in AngularJS

  5. 5

    JavaScript window.location.href not working in localhost

  6. 6

    window.location.href and hash are not working on chrome

  7. 7

    Javascript window.location.href onClick not working

  8. 8

    window.location.href not working as expected

  9. 9

    `window.location.href` not working as intended

  10. 10

    window.location.href isn't working

  11. 11

    *ngIf window.location.href.indexOf is not working

  12. 12

    window.open() not working in IE11

  13. 13

    IE11 not able to get the the current URL using document.location.href OR $(location).attr("href")

  14. 14

    Redirect a Website to a local folder Using window.location.href() not working

  15. 15

    window.location.href not working, mod rewrite or jquery?

  16. 16

    preventDefault stops window.location.href from working

  17. 17

    window.location.href not working after Response.End()

  18. 18

    location.href not working

  19. 19

    Object.defineProperty not working on window object IE11

  20. 20

    Setting window.location or window.open in AngularJS gives "access is denied" in IE 11

  21. 21

    String is not a function on window location href

  22. 22

    window.location = '' is not working ;

  23. 23

    window location not working javascript

  24. 24

    IE 11 + SignalR not working

  25. 25

    calc not working ie 11

  26. 26

    jQuery not working with IE 11

  27. 27

    css not working in IE 11

  28. 28

    Setting window.location with &copy anywhere in the URL changes to © in IE11?

  29. 29

    angular4 unit test for window.location.href redirect to external link not working

HotTag

Archive