[removed] does not change the webpage in IE9?

前端 未结 5 1861
独厮守ぢ
独厮守ぢ 2020-12-17 04:42

I am trying to redirect to a different page in IE9 (9.0.3).

When I try to get/set document.location, or document.location.href, or wi

相关标签:
5条回答
  • 2020-12-17 05:02

    See this: http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/c864ae63-66f6-4656-bcae-86b0018d70c9

    Apparently it's a caching bug, you can solve it by appending a timestamp to the destination URL (that is, using a "unique" URL every time).

    0 讨论(0)
  • 2020-12-17 05:02

    Cache may be the reason, try:

    location.href='something.php?tmp=' + Date.parse(new Date())
    

    Hope it helps

    0 讨论(0)
  • 2020-12-17 05:12

    I was also experiencing the same problem but found that adding

    window.event.returnValue = false;
    

    above line in the javascript before the redirection resolved the problem.

    0 讨论(0)
  • 2020-12-17 05:19

    You should use an absolute URL:

    var url = '/section/page/';
    var host = window.location.hostname;
    window.location = 'http://' + host + url;

    Where url is the relative path to your page.

    0 讨论(0)
  • 2020-12-17 05:20

    Perhaps your IE9 has some security restrictions in place that prevent JavaScript from directing URL's. window.location.href = "" should work normally on IE9.

    0 讨论(0)
提交回复
热议问题