Jump Menu : Content | Explore | Comments | Search | Home | Sitemap | Contact | Login | Access.

Important Note for Your Custom Error Pages

Just a note to web designers and code-savvy bloggers: make sure your custom error pages are big enough for the ever-amazing <cough> Internet Explorer browser. If your custom error pages are too small, IE will take the liberty of serving its own proprietary web page, replete with corporate linkage and poor grammar.

How big, baby?

Well, that’s a good question. In order for users of Internet Explorer to enjoy your carefully crafted custom error pages, they need to exceed 512 bytes in size. Using proper doctype markup, your custom pages should include more than around 10 lines (roughly) of additional markup and/or content. A good rule of thumb is to throw down at least a couple of decent-sized chunks of code. If you are going for a minimalist set of custom error pages and need a way to increase overall page size, you can always add a paragraph or two of good ‘ol Lorem Ipsum text as a comment in the markup:

<!-- Just for you, Microsoft! 
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque scelerisque. Donec euismod. Mauris eget pede es vel est tristique adipiscing. Integer in sem a enim molestie elementum. Curabitur elementum, nisl eu dapibus dapibus, libero tortor tincidunt quam, in facilisis arcu lacus ut diam. Nam ultricies felis sed felis. Integer interdum. Quisque iaculis porttitor magna. Fusce aliquet. Nulla felis dui, pulvinar at, rutrum in, fermentum eu, metus. Praesent purus nunc, porta vel, sodales id, fermentum eget, massa.
-->

Um, why?

Don’t ax me why Microsoft chose to implement this bizarre functionality in their browsers. They probably had a reason for doing so. As for why 512 bytes is useful to remember as a minimum page size for IE, let’s have a look at the following table, which shows the file sizes of IE’s default error pages for various HTTP error codes:

Code Description File Size
400 Bad Request > 512 bytes
403 Forbidden > 256 bytes
404 Not Found > 512 bytes
405 Method Not Allowed > 256 bytes
406 Not Acceptable > 512 bytes
408 Request Time-out > 512 bytes
409 Conflict > 512 bytes
410 Gone > 256 bytes
500 Internal Server Error > 512 bytes
501 Not Implemented > 512 bytes
505 HTTP Version Not Supported > 512 bytes

Apparently, IE is programmed to use these default pages if something bigger is unavailable — even if it is explicitly specified elsewhere. In other words, if Microsoft encounters a non-IE error page that is bigger than their own, it is recognized as a legitimate, deliberate alternative and thusly served. As to why Microsoft chose “file size” as the deciding factor, we may never know.

As we may see, there are actually several different minimum error-page file sizes, not just one. Nonetheless, the differences are practically negligible and hardly worth memorizing. Thus, we simply use the largest value as the minimum, and the others are automatically included. So, by ensuring that each of our various custom error pages is at least 512 bytes in size, we ensure that IE recognizes and serves them instead of their own, sad versions.

As always, any additional insight is greatly appreciated! :)

Related articles

About this article

This is article #482, posted by Perishable on Monday, January 21, 2008 @ 09:46am. Categorized as Websites, and tagged with browsers, customize, error, ie, tips. Updated on April 29, 2008. Visited 7005 times. 10 Responses »

BookmarkTrackbackCommentSubscribeExplore

« First 30 Days without Bad Behavior • Up • 6 Ways to Customize WordPress Post Order »


10 Responses

1 • January 22, 2008 at 5:14 am — Louis says:

Thank for the tip; I wonder how you’ve heard of that very strange behavior.

Also, I’m amazed by your HTTP error codes table, it is sexier than Jennifer Aniston :)

2 • January 22, 2008 at 8:33 am — Lisa says:

Lol, I didn’t know this. It’s kinda redundant for Microsoft to set IE like that…no wonder more and more people each day prefer to use Firefox

3 • January 22, 2008 at 8:47 am — Perishable says:

Yes, it is quite bizarre indeed.. and, to confuse designers even more, there was a great deal of misinformation on the Web concerning this “feature” not too long ago: there were several well-ranking articles (if I remember correctly) that were telling people that their custom error pages needed to be less than 512 bytes in order to work! It’s almost like chaos and IE go hand in hand..

4 • January 22, 2008 at 9:19 am — Perishable says:

@Louis: As far as I remember, there was a big fuss over this a couple of years ago.. I forget where it first was mentioned, but there are probably many articles explaining the issue.

I wish my error codes table made as much money as J.A.! ;)

5 • March 18, 2008 at 2:43 pm — Johann says:

Well, the table would be even sexier if the headers were actual <th>’s instead of <td>’s…
Just a thought.

6 • March 19, 2008 at 10:42 am — Perishable says:

Sure, why not! Let me just add that to my list of things to do around here.. Seriously, thanks for the idea, I don’t know why I didn’t think of it myself. Will be changing them soon! ;)

7 • March 19, 2008 at 12:32 pm — Paul says:

Like all things in the MS world, there are registry settings for this.
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\ErrorThresholds
Error - threshold (default)
400 - 512 bytes
403 - 256 bytes
404 - 512 bytes
405 - 256 bytes
406 - 512 bytes
408 - 512 bytes
409 - 512 bytes
410 - 256 bytes
500 - 512 bytes
501 - 512 bytes
505 - 512 bytes

8 • March 19, 2008 at 3:05 pm — Perishable says:

Now that’s what I’m talkin’ about! Excellent information, Paul — Thank you! :)

9 • April 29, 2008 at 11:09 pm — Perishable says:

@Johann: I finally replaced those nasty table headers with “actual <th>’s”! It may have taken over a month to do it, but you’re absolutely right — much sexier! ;)

10 • April 30, 2008 at 4:35 am — Johann says:

Wohay!

Drop a comment


Set CSS to lite theme
Set CSS to dark theme