We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

javascript: protocol doesn't work -- why?

  • 8 ответов
  • 1 имеет эту проблему
  • 2 просмотра
  • Последний ответ от Mark Filipak

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.

Изменено Mark Filipak

Все ответы (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.

Изменено Mark Filipak

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.

Изменено Mark Filipak

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.