2

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)

asoundmove
1,6671 gold badge9 silver badges10 bronze badges
asked Mar 25, 2011 at 22:10

1 Answer 1

2

< 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".

answered Mar 25, 2011 at 22:31
2
  • You could use it to break an outer loop. But even that purpose is essentially forgotten. 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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.