NOTE: None of the methods documented in this post work anymore. The safe mode dialog was changed and I can find no way to prevent it from displaying.
I have one more post planned about customizing Firefox with add-ons and the CCK Wizard, but I wanted to get this out in the mean time.
A lot of people ask how to disable safe mode in Firefox in an enterprise environment. This post will tell you how to do it with an add-on.
In my previous post about Integrating Add-ons into Firefox, I talked about putting add-ons into the distribution/bundles directory. The important thing to realize about putting add-ons into this directory is they become a part of Firefox. They are not disabled when Firefox is placed into safe mode (and they shouldn't be!). So we can build an add-on that disables safe mode and by placing it here, it will always be executed.
Unfortunately, we can't completely remove the concept of safe mode. The code that makes safe mode happen is in C++ startup code, so we can't mess with that. But we can make it so that when the safe mode dialog appears, it simply is ignored and the browser is restarted. We do that by overriding the safe mode dialog and forcing it to press the "Make Changes and Restart" button without actually making any changes.
This is a very simple add-on that will consist of two files. I'll tell you exactly where to put them and where to name them.
Note: There is no need for an install.rdf when you put add-ons in distribution/bundles. (I just discovered this.) Also, it doesn't matter what the directory is called under bundles.
chrome.manifest goes in distribution/bundles/disablesafemode and looks like this:
content disablesafemode content/ overlay chrome://browser/content/safeMode.xul chrome://disablesafemode/content/safeMode.xul
safeMode.xul goes in distribution/bundles/disablesafemode/content and looks like this:
<?xml version="1.0" encoding="UTF-8"?> <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <dialog hidden="true" id="safeModeDialog" onload="onOK()"/> </overlay>
You can test it by starting Firefox with the -safe-mode parameter or holding down the shift key on Windows or option key on Mac. You'll see the safe mode window show up for a second (sized very small) and then the browser will restart.