简体   繁体   English

document.body无法在已重定向到的页面上的IE中工作?

[英]document.body not working in IE on a page that has been redirected to?

hoping you can help with this. 希望您能对此有所帮助。

I have a link that redirects to a page on another one of our sites 我有一个链接重定向到我们另一个网站上的页面

However, when this redirect happens, I get a "document.body is null" error from JQuery, and a similar error from SWFAddress (_d.body is null); 但是,当发生这种重定向时,我从JQuery中收到“ document.body为null”错误,而从SWFAddress得到了类似的错误(_d.body为null)。 but only in IE. 但仅在IE中。

However, when I enter the redirected to URL directly in IE (aka sans interstitial redirect), the JS error disappears. 但是,当我直接在IE中输入重定向到URL(又称无页内广告重定向)时,JS错误消失了。 It seems this error only comes up when this page is being redirected to. 看来此错误仅在此页面被重定向到时出现。 Any ideas? 有任何想法吗?

I heard similar issues happened when the document doesn't validate with its given Doctype (XHTML 1.0 Transitional in this case). 当文档未使用给定的Doctype(在这种情况下为XHTML 1.0 Transitional)进行验证时,我听到了类似的问题。 The page had minor issues, but I've recoded the page to make sure it validated via the W3C validator on our DMZ server. 该页面存在一些小问题,但是我已经对该页面进行了编码,以确保它可以通过DMZ服务器上的W3C验证器进行验证。 Unfortunately, that doesn't seem to resolve the issue. 不幸的是,这似乎无法解决问题。

Any ideas what could be causing this? 任何想法可能是什么原因造成的? I talked to several Presentation coders on my team and they seem to be stumped. 我与团队中的几个Presentation编码员进行了交谈,他们似乎很沮丧。 Any assistance at all is greatly appreciated. 非常感谢您的协助。

Thanks in advance, - Frank 在此先感谢-弗兰克

Are you trying to access document.body outside of a "document.ready" scenario? 您是否要在“ document.ready”方案之外访问document.body? IE tends to have problems with modifying the DOM before it's fully created, and will choke because of it. IE在完全创建DOM时往往会遇到问题,并且会因此而阻塞。

Specific code samples would help a bit here; 特定的代码示例在这里会有所帮助。 viewing the source in the links you provided didn't provide much insight, sadly. 遗憾的是,在您提供的链接中查看源代码并不能提供很多见识。

对于它的价值:我们能够解决延迟加载swfaddress的类似问题(在swfaddress的脚本标签中添加defer =“ defer”)。

We found a work around. 我们找到了解决方法。 We setup a page that does a JS redirect instead of the original server side redirect we used. 我们设置了一个页面,该页面执行JS重定向,而不是我们使用的原始服务器端重定向。 Using this method seems to have resolved the issue. 使用此方法似乎已经解决了问题。 Still, a very odd bug though... 不过,尽管如此,一个非常奇怪的错误...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM