You are here: Re: meta redirect - on removing .htm extension, Firefox displays HTML - Why? « HTML « IT news, forums, messages
Re: meta redirect - on removing .htm extension, Firefox displays HTML - Why?

Posted by Alan J. Flavell on 10/02/76 11:46

On Sun, 30 Apr 2006, David Smithz wrote:

> I wanted to implement a meta redirect

True redirection is done by an HTTP 30x status response (status 301
permanent redirection would be appropriate, in your case). Abusing
the "meta...refresh" construction, especially with zero delay, is a
pesky nuisance to a lot of users, quite apart from being a violation
of WAI guidelines.[1]

> so that when users visiting a website just type the following for
> example
>
> www.example.com/downloads
>
> instead of
>
> www.example.com/downloads.htm
>
> I wanted the visitor to be redirected to the .htm page.

If that's what you want to achieve, then configure the server to issue
the HTTP redirection transaction accordingly.

> This worked fine, however, when I remove the .htm file name from the
> file, and then view it on Firefox browser, it actually just displays
> the HTML code.

Almost certainly that's because your server is sending it out as
Content-type: text/plain

This is nothing specific to Firefox - the same behaviour would be
expected with any specification-conforming client agent. (Which
typically excludes MSIE: recent security fixes have gone some
way to correct their earlier misbehaviour in this specific area, but
without correcting the fundamental fact that they are deliberately
violating a mandatory requirement of RFC2616).

> How can I make it work so it does not should the HTML code?

One would configure the server to send it with the appropriate
Content-type header.

This is a general technique which anyone offering material on the web
would need to master, by one means or another.[2] But it's the wrong
approach to dealing with this particular problem.

> An example of the code I use is below:

But it's useless here, because the results depend on how your server
is configured, and we can't see that from a usenet posting.

> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">

This comes too late. If the server says Content-type: text/plain then
text/plain is what it is. You can't change that by inserting stuff
that would only have meaning when the content type is text/html. The
whole point of text/plain is that the client agent *must* not
interpret anything which it finds in the content body, no matter how
many pointy-brackets it seems to contain.

> <meta http-equiv="refresh" content="0;
> URL=http://www.example.com/downloads.htm">

And that is what you should not do.

http://www.w3.org/QA/Tips/reback

regards

[1] WAI 1.0 certainly rated it as a violation. I see that for some
bizarre reason the draft 2.0 guidelines are rating it as acceptable,
with the true HTTP redirection rated as only "preferable" - heaven
knows why they say that: let's hope someone knocks some sense into
it before the draft is finished.

http://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element
http://www.w3.org/TR/2005/WD-WCAG20-HTML-TECHS-20050630/#meta_redirect

[2] http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html might
be of interest.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация