What is the difference between "javascript :;" and "javascript:" in the href attribute?

What is the difference between "javascript :;" and "javascript:" in the anchor attribute href?

+5
source share
4 answers

Same as the difference between an empty Javascript file and a Javascript file all in all ;.

Nothing

eval("");
//undefined
eval(";");
//undefined

See http://www.ecma-international.org/ecma-262/5.1/#sec-7.9.1

When, when a program is parsed from left to right, the end of the input token stream occurs, and the parser cannot parse the input token stream as one complete ECMAScript program, then a semicolon is automatically inserted at the end of the input stream.

, , ​​ .

, , JSON Javascript: JSON :

JSON.parse("");
//SyntaxError: Unexpected end of input
eval("");
//undefined

:

+8

javascript: , JavaScript. , script, ;, , . javascript: - , script, . undefined, , URL- javascript:, - , , .

javascript: urls - . onclick href, #, -js- . , Default.

+6

javascript: , javascript, . ; - javascript. ; , -op.

+1
source

javascript:;has javascript:c and an extra semicolon. In addition, there are no differences.

0
source

All Articles