In the following code:

<a onclick="javascript:alert()">

how do you name the javascript: part? Protocol, pseudo-protocol, scheme, label, prefix?

I am only trying to figure out a common name for it, not technically correct term based on what it actually is at the end. So when I say for example "javascript protocol" most people would be able understand what I mean. (I need to use this in a documentation)

1 Answer 1


< a onclick="javascript:alert()">

I don't believe using javascript: in anything other than the href attribute is even valid (though it appears browsers will still execute it - I believe this is because technically javascript: in this context is a label, are you planning to goto javascript;?).

Also, it's considered very bad form to use inline event handlers like that. And if I'm not mistaken it's even been deprecated by W3C.

But, fwiw, when javascript: is used in an href it is called a "pseudo-protocol identifier".

  • You could use it to break an outer loop. But even that purpose is essentially forgotten.
    – Reid
    Commented Mar 25, 2011 at 22:41
  • 1
    @Reid: and completely irrelevant (for use) in an inline event handler. Commented Mar 26, 2011 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.