JavaScript alert not working in Firefox 6

It seems using javascript: and data: URLs (directly in the address bar) are currently not allowed 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

And this is the “bug” that was resolved in the latest version. The last comment also states:

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.

Now:

How do I fix this?

You can’t, you have to wait until they decided for a proper solution. As the comment said, bookmarklets will work, but must be explicitly allowed. If you just want to test code, use either Firebug or the new Scratchpad feature.

Leave a Comment