ค้นหาฝ่ายสนับสนุน

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

เรียนรู้เพิ่มเติม

Javascript does not work in addressbar

  • 7 การตอบกลับ
  • 4 คนมีปัญหานี้
  • 1 ครั้งที่ดู
  • ตอบกลับล่าสุดโดย Rapha-L Pherdiux

more options
  1. 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');

  1. 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.
#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. <CODE> javascript:alert('Hello'); </CODE> #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)

more options

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?

more options

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
more options

@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?

more options

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.

more options

@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.

more options

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
more options

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!