Javascript does not work in addressbar
- 1 Javascript does not work in addressbar. When I type some Javascript code in the addressbar from Firefox, then Firefox will not execute it. Debug console shows some error messages. Even an easy one does not work. But when saved in a HTML-file, or paste in debug console, it does work.
javascript:alert('Hello');
- 2 A HTML document that shows pictures created with Javascript does not work. Firefox does not show the pictures. Mostly to view photos from a directory in a HTML document to share them in a network or some homepage. An array stores the different filenames and gets read by the for loop that creates a table entry for every picture in thee array. All together in a table in 1 document. Sometimes the collected code will appear in a textarea or edited in the debug console.
すべての返信 (7)
On (1), yes, that is correct. You can use Firefox's web console (Ctrl+Shift+k) or you can save the script as a bookmarklet.
(I'm not aware of a way to override Firefox's behavior here, but that doesn't mean there isn't one.)
On (2), does this problem occur on a web server or only on your computer? There are some special security restrictions on pages using the file:// protocol and trying to access folders outside of the folder holding the file you're displaying.
If you have a page online demonstrating this problem, could you post a link to it?
NoScript has a setting to run JavaScript code via the location bar, but best is to use the Web Console (Web Developer > Web Console;Ctrl+Shift+K) or the Scratchpad (Web Developer > Scratchpad;Shift+F4).
- bug 656433 - Disallow javascript: URLs to be run from the URL bar
@cor-el, @jscher2000
For #1: I can execute the Javascript with the debug console (CTRL+Shift+J). It was used to delay some media sensitive websites when restoring the last Firefox session. With the Javascript prompt command I must give permission before load so a media sensitive website. This will prevent auto playing media on some sites too. Also it gets handy for some text conversions. Or for using search commands instead of visiting the website.
Is there some way to let them know to add this feature again on next releases of Firefox?
I think changing the URL bar so javascript URLs do not execute is unlikely to be reversed.
Many people use add-ons or userscripts to prevent media from auto-playing. Easier than racing the page to run a script by hand.
@jscher2000 I want to like Firefox remembers the last visited URLs. I do not want Firefox play these media, when I need Firefox to search something or need Firefox for a short time use. I must wait until Firefox is started and then all these sites with their media content will play toghether and at the same time. Especially with using multiple tabsgets difficult which media are now playing. And where in the line of tabs are the media sites placed. Several URLs are collected at one Javascript line. Mostly the Youtube videos will play automatically.
Must now use a saved Notepad file todo this and copy the URLs from this file in a new tab.
For YouTube videos you can look at this extension:
Firefox shouldn't load all tabs when you start Firefox.
- Tools > Options > Tabs: Don’t load tabs until selected
Request to add #1, so next versions can execute Javascript code from the addressbar again. This nice feature was not a bug. Not via a detour. Let them known!