Friday, February 09, 2007

How to change the Firefox error message page

If you're trying to change the Firefox error message page you won't find that option in the Preferences menu.

If you use Linux, click here.



The Firefox error message page is stored in web page (xhtml) file.

In Windows that file (netError.xhtml) is stored within the archive toolkit.jar

Browse to this folder C:\Program Files\Mozilla Firefox\chrome\

Then inside Explorer in the meu at the top you should have a Tools button



Click Folder Options and then click the View tab at the top




Now make sure the box that says "Hide extensions for known file types" is unchecked.

Click apply, then ok.

Right now would be a good time to make a backup copy of this file in case anything goes wrong.

The file toolkit.jar must be renamed to toolkit.zip so we can open it.

Select the file toolkit.jar and press F2 on the keyboard. Press backspace and the name toolkit.jar should erase, type in toolkit.zip and press enter. Windows will warn you with a pop up, ignore it.

Open the file toolkit.zip

Open the content folder

Open the Global folder

Find the file netError.xhtml

Extract this file to your desktop, my documents or where ever.

This is the file which generates the Firefox error message page :



You can edit this file with notepad and make whatever changes you desire. After you change the netError.xhtml page you MUST put it back into the toolkit.zip file.

To do this :
  1. Right click the custom netError.xhtml file you made, left click copy
  2. Open toolkit.zip, open the content folder, open the Global folder
  3. Right click, chose paste - or maybe go to Edit @ the top and chose paste. You may even be able to drag and drop the file into this window.
  4. If it ask you if you want to overwrite the old file chose yes

You MUST rename toolkit.zip back to toolkit.jar

You may have to restart Firefox to get the effect.

I changed mine to this :



Code :


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&loadError.label;</title>
</head>
<body>Problem Loading Page</body>
</html>






Linux / Ubuntu
How To change the Firefox Error Message Page


Update :
I recently did a system update and now the netError.xhtml is setup like on Windows (contained inside of toolkit.jar in the /opt/firefox/chrome/ directory). I basically had to the same steps as on Windows. Extract the file from toolkit.jar, edit it, re-add it to toolkit.jar then restart Firefox. If your setup is the same the below directions will not work.

I use Kubuntu Linux, it's a spin off Ubuntu which of course is based on the popular distribution Debian.

Kubuntu Ubuntu

On my machine the file netError.xhtml was located in :

/usr/share/firefox/chrome/toolkit/content/global/

This may be different on your machine. Try doing a file search for it if you can't find it there.

In my case I did this command to edit it :

sudo kate /usr/share/firefox/chrome/toolkit/content/global/netError.xhtml

4 comments:

Anonymous said...

Thanks for this info.. exactly what I was looking for, and it worked. I added a javascript refresh for history.go(-1) to try again.

We run this browser in the lobby of our office, and it runs live pages, so we obviously don't want it stuck on an error page if there is a drop in the connection, or ??.

Thx

Anonymous said...

Hi, this looks quite interesting and I got the basic setup working.

I'd also like to have Firefox try again for the page it was on if connection is dropped. But I can't get Javascript working to do this. There's no errors or anything, it just doesn't work. I'm a novice with Javascript but I have done similar refresh's before.

Can you please post how did you do that Javascript to force FF to try again?

Anonymous said...

Thanks for the post. It is really helpful.

I am looking for "Secure connection failed" message page but I can't find it. Do you have any idea where could I find it. I found "Site Blocked" message page but still I can't find "Secure connection failed" message page.

Thanks,

Colour Printers said...

I am so happy to come across this piece of write up, very much advanced my understanding to the next top level. Great job and continue to do same.
printers sydney

//]]>