Dette websted vil have begrænset funktionalitet, mens vi gennemgår vedligeholdelse for at forbedre din oplevelse. Hvis en artikel ikke løser dit problem, og du vil stille et spørgsmål, har vi vores supportfællesskab, der venter på at hjælpe dig på @FirefoxSupport på Twitter og/r/firefox på Reddit.

Søg i Support

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.

Læs mere

javascript: protocol doesn't work -- why?

more options

My goal is to make the javascript: protocol work again.

I think I need to 'about:config' in order to change what I need to change. But I don't know what the Thing is called -- You see, there's no key to the GUI.

The Thing: Users paste URLs into a text box. What's the name of that text box? I will look in 'about:config' for that name. Maybe I'll find the solution to the following Problem.

The Problem: If I paste this... javascript:Math.floor(10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000)/10 ...into the text box, "javascript:" gets stripped so that the text becomes... Math.floor(10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000)/10 ...and FFox responds with "Hmm. That address doesn’t look right."

If I manually add "javascript:", I still get the FFox complaint.

How can I get the correct operation of that text box (whatever it's called)? Also, how can I stop the drop-down behavior. I hate it.

Thanks, Mark.

My goal is to make the javascript: protocol work again. I think I need to 'about:config' in order to change what I need to change. But I don't know what the Thing is called -- You see, there's no key to the GUI. The Thing: Users paste URLs into a text box. What's the name of that text box? I will look in 'about:config' for that name. Maybe I'll find the solution to the following Problem. The Problem: If I paste this... javascript:Math.floor(10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000)/10 ...into the text box, "javascript:" gets stripped so that the text becomes... Math.floor(10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000)/10 ...and FFox responds with "Hmm. That address doesn’t look right." If I manually add "javascript:", I still get the FFox complaint. How can I get the correct operation of that text box (whatever it's called)? Also, how can I stop the drop-down behavior. I hate it. Thanks, Mark.

Ændret af Mark Filipak den

Alle svar (8)

more options

The location bar can't handle a function like "Math.floor()". You can set this pref to true to show the result of a calculation.

  • about:config => browser.urlbar.suggest.calculator = true

This works for this part:

10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000 

Otherwise you need to use the Web Console to evaluate the code. You would normally use a data URI: data:text/javascript

more options

cor-el said

The location bar ...

Thank you, cor-el. "Location bar", eh? Is that what I'm asking about? Do you have a picture of what a location bar looks like?

... can't handle a function like "Math.floor()".

Why not? This used to work. Maybe we're 'talking' about two different things.

You can set this pref to true to show the result of a calculation.
  • about:config => browser.urlbar.suggest.calculator = true
What's "urlbar". Ah! Is 'urlbar' and 'location bar' the same things? The name 'urlbar' seems right because that's where one would paste a URL to go to a particular web page (or to run some javascript by using the 'javascript:' protocol). I'll bet 'location bar' is 'urlbar'. What do you think?
This works for this part: 10*(70000000000/(3*3600)-(192)*125)/(24/1.001)/1000

Oh, dear. The javascript calculates a relative measure of resolution when comparing videos. I have hundreds of texts that rely on users plugging video parameters -- the numbers -- into the javascript and then pasting the javascript into a browser.

Otherwise you need to use the Web Console to evaluate the code.

No, no. That's complicated. Simply pasting video metrics into the javascript and then pasting the javascript into a web browser is standard across all browsers and it's simple. Web Console changes from browser to browser. It even changes from version to version of the same browser.

You would normally use a data URI: data:text/javascript

Please show me what you mean. Please show me a complete example. I didn't know there's a 'data:' protocol.

Ændret af Mark Filipak den

more options

Stream of consciousness... Location Bar? Address Bar? URL Bar? (from about:config)

Come on. Get some consistent terminology, eh?

My goal is to get the javascript: protocol to work again in the Location/Address/URL Bar. How do I do it?

Pasting this: javascript:1+1 into the Location/Address/URL Bar used to work.

Ændret af Mark Filipak den

more options

You can easily open the Web Console on Firefox by pressing Ctrl+Shift+K or on Chrome by pressing Ctrl+Shift+J.

You can also paste into a bookmark and then click it to execute which also works on Chrome.

javascript:(alert(1+1));

more options

For some unknown reason my Firefox browser doesn’t have JavaScript enabled? I tried but failed multiple attempts to install it and get it to work. Please fix. Thank you

more options

@Joy JavaScript is a built-in component, you can't uninstall or install JS. You can disable JS globally via javascript.enabled (about:config), but that should never be used. Otherwise, problems with JS are likely caused by content blocking extensions you have installed.

If you use extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) that can block content (Adblock Plus, NoScript, DuckDuckGo PE, Disconnect, Ghostery, Privacy Badger, uBlock Origin), always make sure such extensions do not block content.

more options

Joy said

For some unknown reason my Firefox browser doesn’t have JavaScript enabled? I tried but failed multiple attempts to install it and get it to work. Please fix. Thank you

Hi Joy,

Please don't hijack my topic. You will get more attention troubleshooting your js problem if you create your own topic. In it, state why you think js is not enabled and what your symptoms are.