Internet Explorer 无法打开网站
我有一个奇怪的错误,但这似乎只发生在 IE6 中,而且是随机发生的。 我正在公司网站上实施全方位分析。 我制作了一个文字服务器控件并从更新面板内部调用它。 该控件所做的全部工作就是构建 Java 脚本并使用 ScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean) 将 Java 脚本添加到页面。 除了随机错误之外,这一切都很好(见附图)。
根据我的阅读,这似乎是 IE6 中的一个错误,如果在 body 标记内的子元素中创建 java 脚本,则该错误会导致 java 脚本错误,而我的脚本最终会在 form 标记内。 我只是想知道是否有其他方法可以用来注册不会导致此错误的控件。
图片 http://img132.imageshack.us/my.php?image=errornf7 .jpg
// 我似乎无法让图像正确显示,所以我只是链接到它。
I have weird error, but that only appears to be happening in IE6, and it happens randomly.
I’m implementing omniture analytics on my company’s site. I made a literal server control and called it from inside an update panel. All the control does is build the java script and uses ScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean) to add the java script to the page. This all works great except for the random bug (see attached picture).
From what I’ve read, it appears to be a bug in IE6 that renders the java script wrong if its created in a child element inside the body tag, which my script ends up inside a form tag. I’m just wondering if there is any other method I can use to register the control that won’t cause this error.
Image http://img132.imageshack.us/my.php?image=errornf7.jpg
// I cant seem to get the image to show up correctly, so I'll just link to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
抱歉,如果这最终完全偏离基地,但我记得不久前遇到过类似的事情。 我通过在脚本标记中添加“defer”来修复此问题,即:
这可以防止脚本运行,直到页面的其余部分完成加载,从而避免了 IE DOM 错误,听起来与您所得到的非常相似。 不过,我没有使用过 ASP,所以我不知道如何通过 ScriptManager 添加 defer 属性。
Sorry if this ends up being completely off-base, but I remember running into something like this a while back. I fixed it by adding 'defer' to my script tag, i.e.:
This prevents the script from running until the rest of the page has finished loading, which avoids an IE DOM bug that sounds very similar to what you're getting. I haven't used ASP, though, so I don't know how you would add the defer attribute through ScriptManager.
这看起来像是脚本在加载之前修改 DOM 的情况。 如果我是你,我会考虑在 DOM 准备就绪时添加脚本。 许多 JS 库都有这样做的方法。
有关此类错误的更多信息:http: //blog.mjjames.co.uk/2007/11/knowing-whats-on-your-page.html
This looks like a case of the script modifying the DOM before it has loaded. If I were you I would look at adding the script when the DOM is ready. Plenty of JS libraries have ways of doing this.
More information on this sort of error: http://blog.mjjames.co.uk/2007/11/knowing-whats-on-your-page.html
我也遇到过这个问题。 我发现它也会影响 IE6 和某些版本的 IE7。 就我而言,问题实际上是由 ScriptManager.RegisterStartupScript 方法引起的。 一旦我删除它工作正常
I've come across this problem as well. I found it affects IE6 and some versions of IE7 as well. In my case the problem was actually being caused by the ScriptManager.RegisterStartupScript method. Once I removed that it worked fine