Firefox Javascript,停止脚本
基本上,这个脚本检查用户是否正在运行某个插件,如果是,它会显示一个警报...问题是在它显示警报之后,Firefox 的旋转轮不断旋转,就像在等待什么东西一样。如果我刷新页面,脚本将不起作用...
这是代码:
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调用 document.write() 后,需要一个 document.close()。
请参阅此链接。
After calling document.write(), you need a document.close().
See this link.
Firefox 4 已禁用加载 Chrome URL 的功能 - 您仍想这样做吗?我猜旋转可能与需要调用
document.close();
(正如我看到其他人刚刚提到的那样)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)