Spring Sale! Save 30% on all books w/ code: PLANET24
Web Dev + WordPress + Security

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

About the Author
Jeff Starr = Web Developer. Book Author. Secretly Important.
Wizard’s SQL for WordPress: Over 300+ recipes! Check the Demo »

14 responses to “Important Note for Your Custom Error Pages”

  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. Perishable 2008/01/22 8:47 am

    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. Perishable 2008/01/22 9:19 am

    @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. 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. Perishable 2008/03/19 3:05 pm

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

  9. @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 2008/11/12 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 2008/11/16 4:19 pm

    @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. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Digging Into WordPress: Take your WordPress skills to the next level.
Thoughts
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Note to self: encrypting 500 GB of data on my iMac takes around 8 hours.
Getting back into things after a bit of a break. Currently 7° F outside. Chillz.
2024 is going to make 2020 look like a vacation. Prepare accordingly.
First snow of the year :)
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.