1

For security reasons, Firefox and other browsers block local file: URLs like file:///tmp/foo.html that are linked from external web pages. That makes sense to me. But it also blocks access to file: URLs like file:///tmp/foo.html when I manually paste them into the address bar, or link them from another local file such as file:///tmp/bar.html , which would not be a security risk. I also cannot right-click on a local HTML file and open it in Firefox to preview it, which is ridiculously frustrating. Furthermore -- and contradictorily -- Firefox allows me to set my home page to file:///tmp/foo.html , but it does not allow me to set my "new tab" page to file:///tmp/foo.html . An extension exists to address the "new tab" problem, but it does not address the rest of these restrictions.

How can I enable Firefox to display file: URLs that are referenced only from other file: URLs, typed into the address bar, opened locally by right-click from the file manager, or specified as my "new tab" page?

This page says I can disable that security check for specific sites, but I do not know how to specify my local file system as a "site".

Output of lsusb command and uname, in case that helps:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 003 Device 004: ID 0e8d:e025 MediaTek Inc. Wireless_Device
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

$ uname -a
Linux [redacted] 6.17.0-1012-oem #12-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 10 04:51:46 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
2
  • 2
    Does it work if you install the Firefox deb from askubuntu.com/a/1403392/1004020 ? Commented Mar 13 at 17:14
  • 4
    Firefox Snap has this problem due to confinement. Use the .deb version instead. Commented Mar 13 at 18:02

1 Answer 1

1

As suggested by @Thomas_Ward, this problem seems to be limited to the Snap version of Firefox, which is included by default on Ubuntu 24.04. Disabling the Snap version and installing the Debian package version corrected the problem, enabling me to display local files in Firefox using file: URLs.

The steps to disable the Snap version and install the Debian version are described at https://linuxiac.com/install-firefox-from-deb-on-ubuntu-22-04-lts/ and summarized as follows:

  1. Remove the Snap version:

    sudo snap remove --purge firefox
    

    EDIT: I later discovered that the above command did not fully disable the Snap version of firefox. It kept coming back. The following commands, suggested at https://askubuntu.com/a/1545875/121590 , fully disabled the Snap version:

    sudo apt remove --purge firefox*
    sudo snap disable firefox
    sudo snap remove --purge firefox
    sudo apt update
    sudo apt autoremove
    sudo apt clean
    
  2. Import Mozilla repo's key:

    wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
    gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); print "\n"$0"\n"}'
    
  3. Verify that the fingerprint produced by the above command is 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3 . If it does not match that value, then DO NOT CONTINUE, because your installation package may be compromised by an attacker.

  4. Add the debian Firefox repo to your Ubuntu configuration:

     echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
    
  5. Set the debian version as the priority, so that the Snap version will again be used. This is a multi-line command:

     echo '
     Package: *
     Pin: origin packages.mozilla.org
     Pin-Priority: 1000
     ' | sudo tee /etc/apt/preferences.d/mozilla
    
  6. Install debian Firefox:

     sudo apt update
     sudo apt install firefox
    

Done!

1
  • I always said that Canonical's decision of providing the default web browser, which is crucial for system operation, in form of a snap package, is a huge mistake. Such basic things must be native. This is one of the reasons why my next OS - when it's time to upgrade (I'm currently still using 20.04 with ESM) - won't be Ubuntu anymore. Commented Mar 24 at 6:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.