Re: WHICH HTML-CODE is better to use?

Arnoud (galactus@htmlhelp.com)
Sat, 12 Apr 1997 21:09:14 +0200


From: galactus@htmlhelp.com (Arnoud "Galactus" Engelfriet)
To: www-html@w3.org
Subject: Re: WHICH HTML-CODE is better to use?
Date: Sat, 12 Apr 1997 21:09:14 +0200
Message-ID: <a39Tz4uYOZRF089yn@htmlhelp.com>

-----BEGIN PGP SIGNED MESSAGE-----

In article <SISpyZAAHnTzEw+v@bloodaxe.demon.co.uk>,
Andromeda <andrea@bloodaxe.demon.co.uk> wrote:
> In article <334ce6c4.2411761@news.xs4all.nl>, jult@xs4all.DEL.ME.nl
> writes
> ><A HREF="http://www.charliesangels.com">CharliesAngels.com</A>
> 
> It's better with the closing slash than without. Not all browsers will
> find the link without the closing slash. Those that do will be slower. 

In this particular case, the *opening* slash after the hostname
is optional. That's because you can determine immediately what
URL you should ask for: it must be /.

When the hostname is followed by a local part, the browser will always
ask for that directly. If you leave off the slash after a directory
name, the server will tell the browser "301 You forgot the slash,
you moron" and give the correct location. The browser then loads that
document. This is slower, on ALL browsers.

> Strictly speaking, where the browser is following a link with a closing
> slash, it is looking for a directory rather than a file/page (when it
> gets there, it knows to open an index page if one is present). 

The server is the one that sends back the contents of an index document,
should it feel like doing so. The browser asks for "/directory/" and
does not try out "/directory/index.html", "/directory/home.html"
or anything of the sort.

> When the closing slash is absent, it is looking for a file. If it fails
> to find one, it may panic, 

Nonsense. It will simply display the contents of the 404 not found
message that the server sends back when the browser asks for a resource
that does not exist.

> or it may do what Netscape does - add a
> closing slash and try again, unless there is a file extension (.html,
> .gif etc). 

Even more nonsense. Sure, Netscape will try again with the closing
slash, but not because it's so intelligent it can guess what to do
here. The server just told it to try "http://hostname/directory/"
(the old URL, now with the slash) and that is what it does.

The browser (or server) couldn't care less about a file extension.
I can set up a redirection for "file.gif" to "file.gif/" if I want
to. Netscape will do exactly what I tell it to - request "file.gif/"
from my server.

> This causes problems with Netscape though - there are some files which
> do not have extensions or closing slashes (they often have a ? in them)

Those are the results of queries, typically what is sent back when
the browser submits a form with a method of GET>

> - often search engine results pages, or white pages. In this case, if it
> gets straight to the URL all may be well, but if the server or
> connection is slow and Netscape times it out, it will assume that the
> URL is not a file but a directory, stick a closing slash on the end and
> try again - needless to say, this will fail to return anything other
> than an 'Error - Not Found'.

Total and utter nonsense. I really can't say it in a more polite way.

- -- 
E-mail: galactus@htmlhelp.com .................... PGP Key: 512/63B0E665
Maintainer of WDG's HTML reference: <http://www.htmlhelp.com/reference/>


-----END PGP SIGNED MESSAGE-----