gpt4 book ai didi

JavaScript 警报在 Firefox 6 中不起作用

转载 作者:行者123 更新时间:2023-12-03 03:14:17 24 4
gpt4 key购买 nike

我尝试在 Firefox 6 的地址栏中运行此 JavaScript 代码:

javascript:alert("Hello")

我得到一个

ReferenceError: alert not defined.

它曾经在 Firefox 5 中运行良好,现在仍然可以在 Opera、Safari 和 Chrome 上运行。我该如何解决?

最佳答案

目前似乎不允许使用 javascript:data: URL(直接在地址栏中)as per this comment :

FYI, I'm probably going to split this bug into multiple, short and longer term fixes.

Short term: disallow pasting of javascript: URLs into the URL bar
Longer term: additionally require that bookmarklets be "whitelisted" in the Bookmark Manager before it can run JavaScript

this is the "bug"这已在 latest version 中解决。 last comment还指出:

javascript: is not actually ignored - they're run, but in an "empty" context that doesn't have any of the usual DOM methods you would expect, so most common uses (e.g. javascript:alert(1)) just throw (and thus are effectively ignored). javascript:1+1 works fine, though.

现在:

How do I fix this?

你不能,你必须等到他们决定找到合适的解决方案。正如评论所说,小书签可以工作,但必须明确允许。如果您只想测试代码,请使用 Firebug或新的Scratchpad功能。

关于JavaScript 警报在 Firefox 6 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6643414/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com