Skip to content

Instantly share code, notes, and snippets.

@varadekd
Last active April 29, 2024 06:22
Show Gist options
  • Save varadekd/6432c57505f69b6c4da4f76be6d120a9 to your computer and use it in GitHub Desktop.
Save varadekd/6432c57505f69b6c4da4f76be6d120a9 to your computer and use it in GitHub Desktop.

To disable CORS for file:// errrors in firefox follow the steps below.

NOTE: The key name may change based on the firefox version, this is valid till firefox version Mozilla Firefox 125.0.2,

  1. Open Firefox and type about:config in the address bar.
  2. Accept the warning about changing advanced settings.
  3. Search for security.fileuri.strict_origin_policy and set it to false.
  4. Once the testing is completed, set security.fileuri.strict_origin_policy back to true

To disable CORS for file:// errrors in chrome follow the steps below.

NOTE: These steps are for Unbuntu OS

  1. Make sure your chrome browser is closed.
  2. Open terminal and run the following command google-chrome --disable-web-security --user-data-dir
  3. Remember that disabling CORS can expose your browser to security risks, so it's essential to revert these changes after testing:
    • Close the Chrome instance that was launched with CORS disabled.
    • Open Chrome normally (without any special flags) for regular browsing.

CAUTION: This change disables CORS restrictions for local file access, but it's not recommended for general browsing due to security implications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment