在我的頁面http://www.sybase-recovery.com/outlook-repair/,我在寫一個非常簡單的腳本theme1.js http://www.sybase-recovery.com/wp-content/themes/datanumen /js/theme1.js,如下:
document.addEventListener('DOMContentLoaded', function () {
var b = 1;
});
但是在除錯程序中,我發現 DOMContentLoaded 事件在按 Ctrl F5 加載頁面時會被觸發兩次。
我嘗試在網上搜索,發現兩個結果:
- DOMContentLoaded 事件為單個頁面加載觸發兩次,這表示 AVG 附加組件會導致問題,但我沒有安裝 AVG 附加組件。
- http://forums.mozillazine.org/viewtopic.php?f=19&t=1590225,它在https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Detecting_page_load提供了解決方案,但鏈接已斷開。
有沒有人遇到過類似的問題?
謝謝
uj5u.com熱心網友回復:
因為你的頁面有一個 iframe
<iframe width="100%" height="800px" src="http://www.sybase-recovery.com/support/documentation/outlook-repair/"></iframe>
它還包含相同的 theme1.js 檔案
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/341045.html
標籤:javascript
上一篇:如何在按鈕標簽中添加圖示?
