Disabling Safe Mode (Again)

It’s no longer possible to disable safe mode after Firefox 39 because of the removal of the distribution directory.

So lots of people are having trouble disabling safe mode using my earlier instructions and I discovered it is because of problems overlaying the dialog. So here are some new instructions that should work for everyone.

First, create a disablesafemode directory in distribution/bundles where the Firefox executable is located (you’ll probable have to create the distribution and bundles directories as well). Then create a file called chrome.manifest that looks like this:

content disablesafemode content/
override chrome://browser/content/safeMode.xul chrome://disablesafemode/content/safeMode.xul

Then create a subdirectory called content. In that directory, create a file called safeMode.xul that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/"?>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        id="safeModeDialog"
        buttons=","
        ondialogcancel="closeFirefox();">
  <script type="application/x-javascript;version=1.7">
  <![CDATA[
  function closeFirefox() {
    Components.utils.import("resource://gre/modules/Services.jsm");
    Services.startup.quit(Services.startup.eForceQuit);
  }
  ]]>
  </script>
  <description>
  Safe Mode has been disabled.
  </description>
</dialog>

This will cause a dialog to be shown instead of the safe mode dialog that when the user closes, will simply close Firefox. If you’d prefer to show no dialog at all, change ondialogcancel to onload.

I’ve tested this a lot, and it is working for me. Please let me know if you have problems.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

28 thoughts on “Disabling Safe Mode (Again)

  1. Hello Mike! Again, great post.

    I tried this as of August 16, with Firefox version 23 for Windows 7.

    It’s working like a charm. Just followed your instructions above.

    Thanks for keeping us safe. 😀

  2. Hello Mike, I’ve tried disabling Safe Mode on several computers.

    I noticed when I upgraded my firefox to 23.0.1 – it’s NOT working.

    I downloaded the Firefox Installer ~275kb in the website as of Aug. 19, 2013 today, and it upgraded firefox to 23.0.1. then I tried your method above, but it’s NOT working.

    Safe mode launches and there’s a dialog box.

    However, in some of my computers, I installed it same method as above it’s working. That’s really weird.

    Is the problem in my computers? I restarted a lot. I’ll investigate further.

    • Yes, it works on a Mac.

      It can’t actually be an add-on – that’s why the instructions are here. It has to be files in the distribution directory.

  3. Hello Mike, thanks for sharing all this wonderful tips with Firefox.

    But I have a question. I’m also using Thunderbird for my email client, and so far it’s very fast and efficient.

    Is there a way to also disable the Safe-Mode feature of that program?

    Hope you could help. Thanks.

  4. trying this out on firefox 30 on Solaris (I know). Anyways, it seems to close the window, but leaves firefox running in a windowloess state. Thus a user attempt to restart firefox manually results in “firefox already running” message. please help.

    • Odd. It sounds like it’s not running the code to restart Firefox. I’ll see if I can recreate on Linux. I can’t make any promises though.

  5. Mozilla Firefox/distribution/bundles/disablesafemode /content/safeMode.xul

    and

    Mozilla Firefox/chrome.manifest

    That doesn’t work. I mean it does prevent safe mode, which I suppose is sufficient; but no box pops up, and basically glitches out. Windows 7. Firefox 38.0.

  6. Hey mike.

    AWESOME. and there is totally a use case for it… like public libraries and church!

    please keep up the good work.
    got it running with the current firefox ESR (still in 38.4) but the script won’t quite run. running lubuntu 14.0.4 and installed the ESR in /opt then put the chrome.manifest in the root of the binary directory, and created the subfolders as specified. as another person said it stops safe mode, which is sufficient, but if someone is trying to be crafty and appends the shortcut with -safe-mode (as opposed to command line where you can ctrl c out) it’ll keep spinning and requires a reboot before the browser will work since it’s already running.

    never even see a dialogue so it’s right there at the beginning

    very awesome job and thank you again, just a minor complaint if youve got some wizardry up your sleeve. fingers crossed for the next ESR at least

  7. Excellent post. I was checking constantly this weblog and I’m inspired!

    Extremely helpful info particularly the closing phase 🙂 I
    take care of such info much. I used to be seeking this certain info for a long
    time. Thank you and best of luck.