What is javascript: used for, and is it compliant and should I use it?
I noticed that some of my associates choose to use
javascript:
followed by some function name or some JavaScript code, but it seems unnecessary to me.
I see this a lot in event handlers like:
onclick="javascript: somefunction451();"
Also I have trouble searching for more information on javascript: because it says that I’m trying to do cross site scripting. Especially if I stick it in quotes. Is this something that simply can’t be fixed? Should I search this in a Flash only or Silverlight only browser?
It’s completely unnecessary in “onfoo” attribute values. In that context, it’s interpreted as a label by the JavaScript parser. Thus it’s not erroneous, but it’s useless.
In “href” values, it has a role, but there’s really no reason for JavaScript “href” values anyway.