Back to top

Allow local files links from remote locations in Firefox

Firefox Development tools Local links on remote URL

Working on a web development project can sometimes require for you to apply a local file from your own computer to a remotely hosted website.

This is disabled for security reasons. It can be enabled for particular locations using Firefox Preferences and this article will show you how.

If for any reason you need to work on a remotely hosted project without building your local instance and you need to keep applying changes to a file and keep testing the changes on the remote environment it's useful to be able to load the local file through your Development tools and apply it to the remote without actually uploading the changes to the remote host.

That way you can continually modify and test the changes without having to re-upload the file each time. The file can be an image, a stylesheet, a javascript file, or any other type you might be working on.

But the linking of local files doesn't work without adjusting your browser preferences or using an add-on, because browsers block loading local files from remote locations for security reasons.

Change Firefox preferences for loading local files

To allow Firefox to load local files from remote locations there are three preferences that need to be added to your browser configuration manually.

The preferences are:

  1. user_pref("capability.policy.policynames", "localfilelinks");
  2. user_pref("capability.policy.localfilelinks.sites", "http://www.example.com");
  3. user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

You can add them to the user.js or prefs.js files directly or use the about:config tool:

Firefox about:config Add new String preferences

Acknowledge the warning before the tool is opened and be careful what you do while in there. These preferences don't exist by default so we need to add them ourselves. Right-click to get the menu pop-up, or use the Shift + F10 keyboard shortcut.

All three preferences are String types so choose that option when creating them. First you enter the preference name:

Firefox enter Preference name Local files links

and then the value for that particular preference:

Allow local files links from remote locations in #Firefox Tweet this

Repeat for the remaining two preferences to get your local files to appear on the remote location.

You can add more than one remote location to the list of sites, simply separate them with spaces. Make sure you include the URI schema and exclude trailing /:

  1. http://www.example.com http://otherexample.com

To find out more about this read the article on mozillaZine: Links to local pages do not work.

Need any help with this or any other similar problem? Contact me for a friendly chat, to share about your project and see how I can help you solve any issues you have.
What did you think of this article?