Wednesday, 15 May 2013

"javascript:" prefix in an html attribute -



"javascript:" prefix in an html attribute -

i've noticed 3rd party libraries utilize "javascript:" prefix before method, in html variable. not advocate of inline javascript, curious know does?

here example:

data-permalink="javascript:nrelate.xgeba('meta', 'property', 'og:url')0.content;"

i anticipate prefix meant allow method phone call execute , assign value dynamically attribute, piece of test code tells me differently: http://codepen.io/anon/pen/hxzba.

the library using info attribute verbatim href a tag. when placed thusly, code execute when link clicked.

otherwise, javascript set value of data-* attributes not auto-execute.

javascript prefix

No comments:

Post a Comment