edmullen dot net

NOTE: No longer works in SM 2.x or Firefox after, I think, v.3.5.

You could adapt the technique below for the newer versions. In the installation folder of the app (SM or FF) is a file called "omni.ja". It is simply a zip archive file and it contains the file "nsSidebar.js" mentioned below. You would need to open the file, unzip the nsSidebar.js, modify it, re-add it to the omni.ja file, save the file.

As I mention below, whenever you upgrade to a new version you'd need to do the process all over again. Since the Mozilla apps have moved to an accelerated release schedule this has become a real pain. As such, I'm just leaving this page here for the sake of posterity. ;-)

SIDEBARS ON A LOCAL DISK DRIVE - This has been frustrating me for a long time. I finally seem to have it figured out.
The Issue

How can I install a sidebar from a local disk drive in Mozilla/SeaMonkey? I have some customized ones that are not available to the public and the only way I've been able to use them is to have them reside on one of my Web servers. That means the sidebars won't work unless I have an active connection to the Internet. It also means that I can't access any links in the sidebar that point to local drive/system resources.

I understand that this is by design for security reasons. It would be a bad thing to have links on a Web page that would give access to the local system. However, it's my sidebar on my system that I'm trying to access using those links. The sidebar is on my PC, the link accesses my PC, there's no way for anyone to tap into that. Besides, if I can type C:\ into Mozilla's location bar and view my drive contents, how come I can't do it with a sidebar?

The Solution

There is a function in the sidebar operation that limits installation of sidebars to the following URLs:

Obviously, that limitation is what I'm trying to overcome. Turns out it's pretty simple. The sidebar operation code resides in a javascript file in the Mozilla program's installation location. That should be located at:

[installation drive]:\Program Files\mozilla.org\Mozilla\components\nsSidebar.js

Inside that file is the following bit of code:

function sidebarURLSecurityCheck(url)
if (url.search(/(^http:|^ftp:|^https:)/) == -1)
throw "Script attempted to add sidebar panel from illegal source";

All I did was add the URL "file:" to that list on the first line of code. Here's what that section of the file now looks like in my modified file:

* The following change made by Ed Mullen, May 23, 2005
* added "|^file:" (no quotes) to the sidebarURLSecurityCheck function
* to allow installing a sidebar located on a local hard drive

function sidebarURLSecurityCheck(url)
if (url.search(/(^http:|^ftp:|^https:|^file:)/) == -1)
throw "Script attempted to add sidebar panel from illegal source";
/* end of modification */

Voila! And stunningly simple.

The easiest way to install a local sidebar that I've been able to figure out is:


As always, if you have comments or questions, email me.

This page last changed: September 2, 2015 - 12:50 PM USA Eastern Time

Copyright Ed Mullen | Contact Ed

click for home page