2

基本上,這個腳本檢查用戶是否正在運行某個插件,如果是,它會顯示警報......問題在於它顯示警報之後Firefox的旋轉輪一直在旋轉,就像它在等待某個東西。如果我刷新頁面腳本不工作...Firefox javascript,停止腳本

這是代碼:

<script language="javascript"> 
    var isInstalled = false; 

    function run_if_true() { 
    isInstalled = true; 
    document.write("Your addon is installed\n<br>");alert("a"); 
    } 

    function check_installed() { 
    if (isInstalled==false) { 
     document.write("Not installed"); // You can instead have an alert here 
    } else { 
     document.write("is installed"); 
    } 
    } 
</script> 
</head> 

<body onload="javascript:check_installed()"> 
    testing! 
    <img src="chrome://fil/content/sd.gif" 
     width="0" 
     height="0" 
     onload="javascript: run_if_true()" 
     style="visibility:hidden"> 
</body> 
</html> 
+0

可能重複[你如何停止瀏覽器'沙漏'時,Javascript是完成(停止throbber) ?](http://stackoverflow.com/questions/6067976/how-do-you-stop-browser-from-hourglassing-when-javascript-is-done-stop-throbbe) – 2011-05-31 03:45:02

回答

4

調用document.write()的後,你需要一個document.close()。

看到這個link

+0

謝謝!這確實是問題! – Ryan 2011-05-31 13:49:25

0

加載Chrome瀏覽器URL的能力已被Firefox 4禁用 - 您仍然希望這樣做?旋轉,我猜可能涉及需要呼叫document.close();(因爲我看到別人剛剛提到)