document.location不会更改IE9中的网页? [英] document.location does not change the webpage in IE9?
问题描述
当我尝试获取/设置文档时,我试图重定向到IE9(9.0.3)中的其他页面。位置
或 document.location.href
或 window.location
/ window.location.href
,我无法这样做。没有发生任何错误,它失败。
我已经尝试检查文档和窗口对象是否被设置,并且它们是,所以我不知道为什么位置对象是缺少。
我尝试获取 document.URL
,这样做很正常,但它是只读的
任何人都知道问题是什么,还是以跨浏览器方式实现?
我也遇到同样的问题,但发现添加
window.event.returnValue =假;
在JavaScript之前的重定向解决问题。
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 window.location
/window.location.href
, I'm unable to do so. It fails without giving any errors.
I've tried to check whether the document and windows objects are set, and they are, so I have no idea why the location object is "missing".
I tried getting the document.URL
and that works fine, but it's read-only.
Anyone know what the problem is or how to achieve this in a cross-browser way?
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.
这篇关于document.location不会更改IE9中的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!