"yawnmoth" <te*******@yahoo.com> writes:
I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.
<input onkeyup="javascript: ..." />
Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway?
It's supposed to be the script langauge set as the Content-Script-Type
(e.g., <meta http-equiv="Content-Script-Type" content="text/javascript">)
but all browsers default to Javascript if nothing else is specified.
In IE, it's possible to have a default language of VBScript. In order
to allow event handlers in Javascript anyway, the prefix "javascript:"
will make IE treat the content as Javascript independently of what
the default language is.
In all other browsers it's just a label, which can be seen by this
example:
<div onclick="javascript:while(true){break javascript;}alert('done')">
X</div>
click the X and see an alert in non-IE browsers and an error in IE
(unknown label).
As such, isn't usint hte javascript pseudo-protocol redundant?
If that was what it meant, it would be redundant. Actually, it's just
misguided.
...or was it required on some archaic browser like Netscape 4.0 or
something?
No, never. The only place where it has any use is in multi-script-
language pages written specifically for IE. In a page meant for the
internet, any occurence of "javascript
:" should be considered a
problem[1]
/L
[1] Unless you are showing off your bookmarklets.
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'