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();(因为我看到别人刚刚提到)