Firefox Local Mode
Firefox's Local Mode is a feature that enables the registration of multiple mappings to load local files through custom HTTPS URLs. This eliminates the need for a separate HTTP server to test web pages and allows testing of all Web APIs, even those restricted to Secure Contexts. Moreover, it facilitates the creation of distinct origins for each experiment or project, ensuring dedicated storage and cookies for each.
These mappings are exclusively accessible within Firefox and cannot be utilized by any other program or malicious software on your computer or local network.
To set up mappings, developers can access the Options panel in Firefox's DevTools. From there, they can register as many mappings as required. The screenshot demonstrates loading of https://firefox.localhost from /home/alex/app. Whenever a file:// URL is loaded while DevTools is active, a notification appears at the top of the DevTools window.
The first action, "Add To Settings," redirects the user to the Options panel and registers a new mapping for the loaded file URL. The second action, "Try it," registers a transient mapping to load the current file or folder as an HTTPS URL, which is removed upon closing DevTools or Firefox.
Mappings can also be managed within about:config using preferences, enabling easy import, transfer, and automation between profiles. Each mapping consists of three preferences: devtools.local-mode.mappings.${index}.origin, which specifies the mapping's origin (e.g., "firefox.localhost"); devtools.local-mode.mappings.${index}.path, which defines the absolute path to the local folder (e.g., "/home/hello-world"); and an optional devtools.local-mode.mappings.${index}.disabled, a boolean value to disable the mapping (where ${index} is an incremental integer to uniquely identify each mapping). Examples of such mappings can be found in about:config.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.