IE8 中"HTML Parsing Error:Unable to modify the parent container element before the child element is c

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情

一、

又涨见识了
IE8报下面错误,而且是我的机器不报,同事的机器报,试了4台,两个报,两个不报,IE版本都一样,没想明白
解决:

1、查看是否有未关闭的html标签,比如<table>而没有</table> (我就是这个原因)
2、是否在页面未加载完前js代码操作了body里的元素,将相关js代码移到</body>后面

网页错误详细信息

用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
时间戳: Wed, 14 Apr 2010 08:33:56 UTC


消息: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
行: 0
字符: 0
代码: 0
URI: 

http://support.microsoft.com/kb/927917

二、

它的发生,是因为某些DOM操作发生在DOM树加载完成之前,比如appendChild

就像下面的代码:

<html>
<head>
</head>
<body>
<div>
<script type="text/javascript">
    alert(document.readyState);
    var oDiv = document.createElement("DIV");
    oDiv.innerHTML = 'test odiv test odiv';
    document.body.appendChild(oDiv);
</script>
</div>
</body>
</html>

当解析到DIV时就开始在BODY上appendChild,而这个时候BODY是还没有完全就绪的(It is not fully loaded),文档结构仍在loading和interactive状态之间,于是,便会得到上述错误。当然,该错误目前已确切知道的会存在于IE6和 IE7两个版本中(低于IE6的未进行测试),在IE8中将会得到一个HTML解析错误:HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)

1.要解决这个问题,可以进行document.readyState状态判断,当它为complete时再进行相应的操作,或者给script标签加上defer属性(该属性在IE8中已不获支持)。


2.或者


js中加入了 setTimeout("XXXX()",1000);,使其获得足够的加载时间后执行目标(XXXX)的function,于是问题得到解决

来源:http://blog.163.com/xiao_mege/blog/static/72942753201102491443802/

IE"HTML Parsing Error:Unable to modify the parent container element before the   错误: IE 中"HTML Parsing Error:Unable to modify the parent container element before the child element is closed"     现象: 同事之间几个IE 测试情况下,有的报这个错,有的不报。经查询资料后,可归纳以下原因。        ... 阅读详情

相关推荐

IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is...

一、 又长见识了 IE8报下面错误,而且是我的机器不报,同事的机器报,试了4台,两个报,两个不报,IE版本都一样,没想明白 解决: 1、查看是否有未关闭的html标签,比如<table>而没有</table> (我就是这个原因) 2、是否在页面未加载完前js代码操作了body里的元素,将相关js代码移到</body>后面 网页错误详细信息 用户代理: ...

Quber 342

HTML Parsing Error: Unable to modify the parent container element before the child element is closed

IE8浏览器下调试JS时, 碰到了这个错误, 最终发现原因是缺少div的结束标签. 转载的这篇文章虽没能解决我的问题, 但我觉得写得挺好, 转载在此, 以便日后碰到类似问题作为参考. 原本地址: http://www.cnblogs.com/grenet/archive/2012/04/24/2467571.html 感谢原作者. ==========================以下为

pansanday的专栏 1832

IE8报错:Unable to modify the parent container element before the child element is closed

转自:http://blog.csdn.net/xinwang/article/details/9786447IE8中会报HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)这个错误。 将JS代码或引用文件放入页面底部的bod

smstong的成长轨迹 6704

HTML Parsing Error: Unable to modify the parent co

HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) 主要是因为页面没有加载完 就调用元素 引起的错误 在js中加入 setTimeout("xxxx()",500); 可以解决...

418

IE8"HTML Parsing Error:Unable to modify the parent container element before the child element is c...

一、 又涨见识了IE8报下面错误,而且是我的机器不报,同事的机器报,试了4台,两个报,两个不报,IE版本都一样,没想明白解决: 1、查看是否有未关闭的html标签,比如<table>而没有</table> (我就是这个原因)2、是否在页面未加载完前js代码操作了body里的元素,将相关js代码移到</body>后面网页错误详细信息用 户代理: Mozill...

weixin_30270889的博客 81

IE 8 HTML Parsing Error: Unable to modify the parent container element before the child element is c

它的发生,是因为某些DOM操作发生在DOM树加载完成之前,比如appendChild 就像下面的代码:     alert(document.readyState);     var oDiv = document.createElement("DIV");     oDiv.innerHTML = 'test odiv test odiv';     d

fox123871的专栏 1330

HTML Parsing Error: Unable to modify the parent container element before the child element is closed...

IE8报错误: 用户代理:Mozilla/4.0(compatible;MSIE8.0;WindowsNT5.1;Trident/4.0;.NETCLR2.0.50727;.NETCLR3.0.04506.648;.NETCLR3.5.21022;.NET4.0C;.NETCLR3.0.4506.2152;.NETCLR3.5.30729;.N...

weixin_30268921的博客 165

HTML Parsing Error: Unable to modify the parent container element before the chi

0729)时间戳: Fri, 8 Nov 2013 06:49:18 UTC消息: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)行: 0字符: 0代码: 0URI: http://crm.jiwu.com/jwcus!followcus.action?crmrnd=165      解决办法: http://www.micr

254

HTML Parsing Error:Unable to modify the parent container element before the child element is closed

一、 又涨见识了 IE8报下面错误,而且是我的机器不报,同事的机器报,试了4台,两个报,两个不报,IE版本都一样,没想明白 解决: 1、查看是否有未关闭的html标签,比如而没有 (我就是这个原因) 2、是否在页面未加载完前js代码操作了body里的元素,将相关js代码移到后面 网页错误详细信息 用 户代理: Mozilla/4.0 (compatible; MSIE

jumtre的专栏 1222

IE 8 HTML Parsing Error:Unable to modify the parent container element before the child element is cl

一、错误信息提示IE8下消息: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)行:

sunlylorn的专栏 7160

javascript错误解决:Unable to modify the parent container element before the child element is closed

全部报错信息如下。 网页错误详细信息 用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; CIBA) 时

在AC与WA间徘徊 5881

Unable to modify the parent container element before the child element is closed

今天在调试程序的时候,第一次登录进入页面时,总是没有加载完,直到第二次第三次登录进入的时候页面才完全加载完成,打开页面的错误提示后才发现报了下面的错误:  HTML Parsing Error: Unable to modify the parent container element before the child element is closed 在网上找了下,是因为body里面的节...

binsdream的博客 199
上一篇: document.execCommand(”BackgroundImageCache”, false, true)
下一篇: 用 document.readyState == "complete" 判断页面是否加载完成
白鼠闹东京
博客等级 码龄17年 32粉丝 148原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值