2

Basically, this script checks if the user is running a certain addon, if yes, it shows an alert... the problem is after it shows the alert Firefox's spinning wheel keeps spinning like it's waiting for something. And if I refresh the page the script does not work...

This is the code:

<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>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ryan
  • 9,821
  • 22
  • 66
  • 101
  • possible duplicate of [How do you stop browser from 'hourglassing' when Javascript is DONE (stop throbber)?](http://stackoverflow.com/questions/6067976/how-do-you-stop-browser-from-hourglassing-when-javascript-is-done-stop-throbbe) – Lance Roberts May 31 '11 at 03:45

2 Answers2

4

After calling document.write(), you need a document.close().

See this link.

Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
0

The ability to load Chrome URLs has been disabled by Firefox 4--you still want to do this? The spinning, I'd guess might relate to a need for a call to document.close(); (as I see someone else just mentioned)

Brett Zamir
  • 14,034
  • 6
  • 54
  • 77