views:

299

answers:

1

Hi,

I have an rails app which redirects wrong urls to "/". I made 404.html file and it has the following code.

<script type="text/javascript">
  <!--
  window.location = "http://www.mydomain.com/"
  //-->
</script>

It works well in Firefox but IE doesn't redirect. IE draws its own "The webpage cannot be found." page.

I checked log file and it surely rendered 404.html.

This happens regardless of IE versions.

What's wrong?

Sam

+3  A: 

We all like IE's "features", don't we?

If you create an error page that's too small (in size) than Internet Explorer will display its own error page. This limit for 404 pages is 512 bytes...

You could add some padding to that HTML page or use headers for redirection (that is probably not what rails programmers would do it) or use a catch-all route.

For more info see: http://www.404-error-page.com/404-error-page-too-short-problem-microsoft-ie.shtml

Kalmi
Thank you very much.
Sam Kong
Interesting fact: "If Google Chrome sees a very short, stock 404 page (less than 512 bytes), it talks to Google in order to try to suggest other possible pages and options." - http://www.mattcutts.com/blog/google-chrome-communication/
Kalmi
This Chrome behavior actually causes a few seconds of delay for me before displaying a "small" error page.
Kalmi