cancel
Showing results for 
Search instead for 
Did you mean: 

Running Javascript in Navigation Bar (URL)

Highlighted
New Contributor

Running Javascript in Navigation Bar (URL)

Question: How can I enable in Firefox (currently 7 - beta) to run javascript in the url bar. I mean running: javascript:alert('iaurt'); in the url bar. I remember this worked on previous firefox versions... And this works in IE but on Firefox it doesn't Smiley Sad

6 REPLIES
Site Moderator

Re: Running Javascript in Navigation Bar (URL)

You can no longer run JavaScript code via the location bar in Firefox 6 and later.
You can see an error message in the Tools > Error Console.
That code now gets a null principal for security reasons and doesn't have any effect (Bug 656433).
You need to create a (keyword) bookmarklet and run the code by invoking that bookmark.

NoScript can allow you to run such code via the location bar, see:

New Contributor

Re: Running Javascript in Navigation Bar (URL)

Killing advanced features because "average" users don't need or can't handle them is becoming Mozilla MO. Bye status bar, bye navigation bar javascript, bye market share, hello "hover a link for 5 minutes and the destination appears where the status bar should be".

At least add about:config entries to restore the useful features that keep being removed.

Regular Contributor

Re: Running Javascript in Navigation Bar (URL)

Although entering JS through the URL bar has been disabled for very good security reasons, in the latest Firefox release it's possible to do the same but by different means.

If you go to the "Web Developer" menu (or if you're on a Mac, Tools > Web Developer) and select "Scratchpad" up will pop a box where you can enter some JS, right click and "Run" it on the webpage. The result is exactly the same as one would have by entering stuff into the URL bar.

New Contributor

Re: Running Javascript in Navigation Bar (URL)

You can install this add-on: InheritPrincipal :: Add-ons for Firefox

New Contributor

Re: Running Javascript in Navigation Bar (URL)

Ctrl+Shift+K

New Contributor

Re: Running Javascript in Navigation Bar (URL)

Ctrl+/ without any text selected shows the add-on bar, which is a less powerful version of the status bar.