Latest TweetsVerify any search engine or visitor via CLI Forward-Reverse Lookup perishablepress.com/cli-forwar…
Perishable Press

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! :)

Jeff Starr
About the Author Jeff Starr = Fullstack Developer. Book Author. Teacher. Human Being.
Archives
14 responses
  1. 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. 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. Jeff Starr

    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. Jeff Starr

    @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. Well, the table would be even sexier if the headers were actual <th>’s instead of <td>’s…
    Just a thought.

  6. Jeff Starr

    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. 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. Jeff Starr

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

  9. Jeff Starr

    @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. Wohay!

  11. Stacy Sardelli November 12, 2008 @ 8:31 am

    Does anyone know why my e404.html page still gets redirected to http://urlseek20.vmn.net – despite being larger in text than 512 bytes? My page is noted as 4KB in text. My site is below and I would be so appreciative of any assistance as I am pulling my hair out over this one. Thanks, much.

    http://www.babbleandbeat.com/e404.html

  12. Jeff Starr

    @Stacy: there are several things that may be causing the redirect. Check your htaccess file(s) for custom error-page directives; your blogging platform for custom scripts, 404.php pages, and related plugins; and your 404 file for the presence of a meta refresh tag in the document’s <head> section. Any/all of these things may be causing the 404 to redirect..

    I hope that helps! :)

[ Comments are closed for this post ]