Mediawiki, Mozilla, and remote pages linking to local files

So I’ve got mediawiki running on an intranet web server, and I use it to store notes about the things I’m working on. I downloaded a bunch of docs and started making links to the local copies of the manuals using the standard mediawiki notation, [url alias].

However, in its default configuration, for security reasons, mediawiki does not produce links from URIs starting with file://.

I was able to remedy this by adding the following to my wiki’s LocalSettings.php:

array_push($wgUrlProtocols, 'file://');

The next problem was that my browser itself did not like it that a remote web server was trying to direct me to files on my local machine. It complained with the following in my javascript error console:

Security Error: Content at <remote url> may not load or link to file://<local file path>

This was resolved by a bit of research. At the MozillaZine knowledge base, they recommended adding the following to my user.js:

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

I had a hard time figuring out where, exactly, my user.js file was, so I grabbed a copy of the ChromeEdit Add-on. After re-starting the browser, there was a ChromeEdit Plus menu item under Tools. Selecting ChromeEdit from the submenu brought up a window with a users.js tab. After pasting the above code into the form, modifying for my needs, pressing Save, and then Restart, my browser came back up and allowed me to follow links to local files from the host I indicated in capability.policy.localfilelinks.sites.

This entry was posted in colliertech, firefox, Free Software, mediawiki, security, Software, wiki. Bookmark the permalink.

Leave a Reply