我正在使用 Jquery Ajax 作为登录表单。ajax 成功后,我使用重定向页面window.location.href="test.php"
这在 Chrome、firefox 和 IE9 中工作正常。但在 IE 11 中,它不起作用。
我努力了,
window.location.replace("test.php");
window.location.assign("test.php");
setTimeout('window.navigate("test.php");', 1);
window.open('test.php','_self', null , false);
但一切都失败了。有人可以帮忙吗?
尝试添加前导斜杠:
window.location.assign('/test.php');
解释
无论何时设置位置,其工作方式都与单击同一页面上的超链接非常相似。假设您位于这样的位置:
http://yourdomain.com/this/is/a/very/long/path.php http://yourdomain.com/this/is/a/very/long/path.php
...然后您尝试使用以下任一机制离开此页面没有前导斜杠:
<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");
...你会注意到 URL 变成了这样:
http://yourdomain.com/this/is/a/very/long/path.php http://yourdomain.com/this/is/a/very/long/path.php
但如果你放了一个前导斜杠,/测试.php,那么位置就变成这样:
http://yourdomain.com/test.php http://yourdomain.com/test.php
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)