如何通过IE使用JavaScript导航到URL?

时间:2014-01-06 14:50:14

标签: javascript jquery html internet-explorer url

如何通过IE浏览器使用JavaScript导航到URL,我已尝试过JavaScript的大部分功能,但它们不适用于IE。

window.location.href = ''; //doesn't work for IE
window.location = ''; //doesn't work for IE

window.open(""); //does work for IE but it opens it in a new tab and I don't want this

我需要帮助。 谢谢。

EDIT !!!

window.location.href = ''; //works well for IE, the problem was that I was using jQuery to build my HTML and solved by: jQuery.mobile.navigate("url.html#subPg");

2 个答案:

答案 0 :(得分:1)

试试这个  self.location=”top.htm”;

在IE6,IE7中测试 以下所有方法都应该有效 -

1,

window.location.href=”login.jsp?backurl=”+window.location.href;

2,

window.history.back(-1);

3,

window.navigate(”top.jsp”);

4,

self.location=”top.htm”;

5,

top.location=”error.jsp”;

答案 1 :(得分:0)

试试这个:

<script language="javascript">
window.navigate("");
</script>

或者这个:

<script language="JavaScript">
self.location="";
</script>

-Mohamed Shimran