chrome iconfirefox iconedge icon

Browser Flags

Warning: This feature is a work in progress and may be incomplete or subject to change. If you see an error or something that could be improved, please make a pull-request. The link that documents this feature can be found at the bottom of the page.

Browser flags allow you to pass custom command-line flags to the browser during launch. This can be useful for enabling experimental features, disabling security policies, or customizing the browser's behavior in development mode.

How Does It Work?

When you run your extension in development mode, you can specify browser flags to customize the browser's behavior. Extension.js will hook into the browser's launch process and pass the specified flags to the browser binary.

How to Use Browser Flags

You can configure browser flags in the extension.config.js file by using the browserFlags key. These flags will be passed to the browser when it launches during the development process.

Example Configuration

Here’s an example of how you can use browser flags in your extension.config.js:

module.exports = {
  browser: {
    chrome: {
      browserFlags: ["--disable-web-security", "--auto-open-devtools-for-tabs"],
    },
    firefox: {
      browserFlags: ["--devtools", "--new-instance"],
    },
  },
};

In this example:

  • For Chrome, --disable-web-security disables web security features like CORS, and --auto-open-devtools-for-tabs opens DevTools for each new tab.
  • For Firefox, --devtools opens DevTools by default, and --new-instance launches a new browser instance for testing purposes.

Available Flags for Supported Browsers

The available flags vary between browsers. Below are links to where you can find more information on the supported flags for each browser.

Browser Usage More Information
Chrome extension dev --browser=chrome Chrome Flags
Edge extension dev --browser=edge Edge Flags
Firefox extension dev --browser=firefox Firefox Flags
Chromium-based extension dev --browser=chromium-based Chromium Flags
Gecko-based extension dev --browser=gecko-based Firefox-based browsers share the same flags as Firefox.

If your target browser is not listed here, it may not have publicly disclosed its available flags. If you are aware of resources for browser flags for unsupported browsers, please update this documentation.

Best Practices

  • Test in Different Browsers: Customize browser flags for each supported browser to test behavior across different environments. This helps in ensuring compatibility across all target platforms.

Next Steps