From MozillaZine Knowledge Base
Revision as of 20:36, 26 June 2015 by Dmcritchie (talk | contribs) (→‎Add-ons, nJS Switch to toggle preference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

JavaScript is a programming language supported by many browsers which allows webpage authors to have greater control over the user’s browsing experience. JavaScript is often used to create fly-out menus, invoke pop-up windows, validate form data and so on. Please note that JavaScript is not Java and Jscript is not JavaScript!

Any errors that may occur when the browser tries to run JavaScript will appear in the JavaScript Console.

Enabling JavaScript

Many web pages require JavaScript to work properly. To make sure that JavaScript is enabled, check these settings:

  • Firefox 22 and below: "Tools -> Options -> Content -> Enable JavaScript".
  • Firefox 23 and above: Ensure that the preference javascript.enabled is set to "true" in about:config (see below for details).
  • Mozilla Suite/SeaMonkey: "Edit -> Preferences -> Advanced -> Scripts & Plug-ins -> Enable JavaScript for -> Navigator" (JavaScript is disabled by default for the "Mail & Newsgroups" component , for security reasons.)

If you have enabled JavaScript but it isn't working, make sure that JavaScript isn't being blocked by an extension like NoScript. Firewall programs or other security software can also include options that block JavaScript, such as the "Mobile Code Control" settings in ZoneAlarm Pro [1])

Advanced JavaScript settings

These advanced settings are accessible when you enable JavaScript (see above) and, in Firefox versions previous to Firefox 23, when you click the "Advanced" button. In Firefox 23 and above, see below for the corresponding JavaScript preference settings.

You can allow scripts on web pages to take certain actions by checking the appropriate boxes, or you can prevent the actions by unchecking these settings:

Move or resize existing windows: Allows scripts to change the size or position of the existing window.

Raise or lower windows: Allows scripts to place windows underneath or on top of other windows.

Disable or replace context menus: Allows scripts to disable or change context (right-click) menus.

Hide the status bar: Allows scripts to hide the status bar, as in popup windows.

Change status bar text: Allows scripts to replace the status bar web address (URL) with scrolling text.

Change images: (Mozilla Suite/SeaMonkey): Allows scripts to change or animate images, as in image rollovers. Warning: Do not uncheck this option! Unchecking "Change images" can prevent some images from loading, make some webpage menus harder to navigate and disable features such as zooming in and out of maps [2]. Note: The Advanced JavaScript Settings window in Firefox does not include a "Change images" option (it was removed in Firefox 1.5). If necessary, use about:config to reset the dom.disable_image_src_set preference to the default false value.

JavaScript settings in Firefox 23 and above

In Firefox 23 the option to disable JavaScript and the Advanced JavaScript Settings were removed from the Firefox Options window (bug 851702). You can still access JavaScript settings via about:config or by installing an add-on.

Using about:config

  1. In the address bar, type about:config and press Enter.
  2. Click "I'll be careful, I promise" if a warning message appears
  3. In the search box, search for javascript.enabled
    • To disable JavaScript: Toggle the "javascript.enabled" preference (right-click and select "Toggle" or double-click the preference) to change the value from "true" to to false.
    • To re-enable JavaScript: Toggle the "javascript.enabled" preference to change the value back to "true", which is the default setting.

Advanced JavaScript Settings:

These settings were removed in Firefox 23 but you can use about:config to change the related preference settings, as follows: [3]

Allow scripts to:

[X] Move or resize existing windows: Uncheck this option/preference to disable moving and resizing windows using scripts.

In about:config: dom.disable_window_move_resize (default=false, set to true to block sites)

[ ] Raise or lower windows: Uncheck this option/preference to make sure scripts cannot raise (bring to the front) or lower (send to the back) windows.

In about:config: dom.disable_window_flip (default=true, set to false to allow sites)

[X] Disable or replace context menus: Uncheck this option/preference to prevent web pages from disabling or changing the Firefox context menu.

In about:config: dom.event.contextmenu.enabled (default=true, set to false to block sites)


You can alternatively install an add-on that lets you disable JavaScript, such as

  • JS Switch (11.3kb) addon to toggle preference via Tools and/or a toolbar button.
  • No-Script (to disable JavaScript on a per page basis, as required)
  • QuickJava (to easily disable and enable JavaScript, automatic loading of images, and other content)
  • SettingSanity (adds back removed options for JavaScript, Advanced JavaScript Settings, loading images, and showing the Tab Bar)

See also

External Links