I once read a page a few years ago about the various browsers’ differing implementations of behaviour when a link with an empty href is clicked.
- some of them linked to the directory (
/path/to/file?query→/path/to/) - some of them linked to the exact same URI (
/path/to/file?query→/path/to/file?query) - some of them linked to the same page (
/path/to/file?query→/path/to/file)
…and various other behaviours.
- Is the behaviour defined in a specification?
- If so, what is the correct behaviour?
- If so, have the latest versions of the big five browsers today fixed their implementations?
Since there’s no "specification" for contents of HREF (at least in HTML 4), the browsers can do whatever they damn well please.
UPDATE However, aside from HTML, there’s an RFC3986: Uniform Resource Identifier (URI): Generic Syntax. It has section 4.4. Same-Document Reference which says:
I do not necessarily read the above as "an empty URI MUST cause the client to reload the same socument’s URI", but it does sound like a "best practice" type of wording; so if I was implementing my own browser I’d almost certainly follow such a behavior.
On a related note, here’s a good recent 3/2010) roundup of how browsers treat empty
srcattribute of<img>tag: http://www.nczonline.net/blog/2010/03/16/empty-string-urls-in-html-a-followup/ and http://www.nczonline.net/blog/2010/07/13/empty-string-urls-browser-update/ . Please note that it is a big deal, since having and empty img src would cause the page to endlessly re-load itself in the worst case scenario.