[英]“Operation aborted” error message when loading a webpage in Internet Explorer
嗨,朋友,我為我的項目設計了一個頁面。 在那我顯示來自數據庫的數據。
問題在於它顯示了數據,但是隨后出現一個消息框,指出:
Internet Explorer無法打開Internet網站“ http:// localhost / ....”操作中止
請幫助我解決此問題。
當您使用javascript並嘗試在元素加載完成之前對其進行修改時,“操作中止”消息通常會在IE中發生。
如果可能,請延遲運行腳本,直到onload
為止。
您可以使用IE博客提供的腳本來調查問題。 請參閱: http : //blogs.msdn.com/ie/archive/2009/09/03/preventing-operation-aborted-scenarios.aspx
導致此問題的最常見代碼( KB927917 )是從腳本(不是直接指向body元素的腳本)追加到body元素。 換句話說,從子節點寫入body元素會引發此錯誤。
<body>
<script type="text/javascript">
document.body.appendChild(document.createElement('div'))
</script>
</body>
<body>
<div>
<script type="text/javascript">
document.body.appendChild(document.createElement('div'))
</script>
</div>
</body>
創建一個可以寫入的已關閉元素。
<body>
<div><!-- add content to me instead of appending to the body --></div>
<div>
<script type="text/javascript">
document.getElementsByTagName('div')[0].appendChild(document.createElement('div'))
</script>
</div>
</div>
您也可以以編程方式創建該div。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.