W3C home > Mailing lists > Public > www-html@w3.org > January 2001

Re: 2 HTML tags in one document

From: Clover Andrew <aclover@1VALUE.com>
Date: Fri, 19 Jan 2001 12:19:36 +0100
Message-ID: <5F78AA062F6AD311A59000508B4AAF6D092C25@PCS02>
To: "'www-html@w3.org'" <www-html@w3.org>
wong yenchin <galilee5@hotmail.com> wrote:

> I am confused here.  In the above mentioned case, the URL, 
> finished.html, now become an event which is a command in
> the Javascript instead of just a location.

Indeed. There's a simple link backup for non-JS browsers, of
course.

Meta-refresh with a simple link backup for non-refresh-aware
browsers would work equally well, but since meta tags can only
happen in the <head>, you can't include a refresh after half the
document has already been loaded - which is why Zdenek tried to
include two <head> sections in one response, in the original
post.

JavaScript does not have this limitation. As a side note, using
location.replace allows the browser to jump to the target page
without including the redirection page in the history, so the
back button will jump straight through it. meta-refresh will
require two back clicks; 0-second meta-refresh will break the
back button.

> Javascript: URLS should be banned and meta-finish is 
> non-standard. That's a bit tough.

Well, I'm a picky old sod. :-)

javascript: URLs really do have no place at all in a production
site: *everything* they do could better be done by putting
JavaScript in event code (onload, etc.) - unless anyone can think
of any counterexamples(*). Due to their wrong-headed design,
hiding executable code where code was never designed to go,
they have caused dozens of serious security holes. The web would
be a much better place if browser writers unilaterally disabled
them.

meta-refresh (or setting the Refresh header in HTTP) does have its
uses (eg. webcams), but redirection is *not* one of them. HTTP
already has a perfectly good redirection mechanism built-in,
which works with all browsers and search engines, so there's no
need to abuse meta-refresh in this way. People tend to do it because
they only know about HTML, and so assume everything should be done
in HTML.

(*) - OK, javascript: URLs have exactly *one* use: typing them in
    in the URL field in order to debug pages, eg.
    "javascript:alert(myVariable);", and bookmarklets. A proper
    JavaScript console removes the need for this, however.

-- 
Andrew Clover
Technical Support
1VALUE.com AG
Received on Friday, 19 January 2001 06:26:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:45 GMT