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

标签 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

请帮我解决这个问题。 谢谢。

编辑!!!

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");

最佳答案

试试这个 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”;

关于javascript - 如何通过 IE 使用 JavaScript 导航到 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20952541/

相关文章:

javascript - 无法将 google trend 中的 js 片段添加到 HTML 页面中

javascript - 如果搜索包含括号或方括号,正则表达式匹配返回未定义

javascript - 不能清空数组扩展类的元素

javascript - 我如何从 p 标签中获取文本并将其插入到 href 链接中

javascript - 在 Jquery 中执行 replaceWith 时,文本在特殊字符后被 chop

javascript - codeigniter 将 html 渲染为图像

javascript - 检查多维输入数组中的值

javascript - 使图像在div内随机移动

javascript - elevateZoom 上的 BSCarousel 错误

html - CSS 正在减慢页面呈现速度