href syntax in allowing javascript -


i wondering whether injecting javascript href tag text inside possible or not. know can this:

<a href="javascript:alert(1)"> 

now if href value has text like:

<a href="hello welcome xxxx site"> 

within quotes how possible inject javascript? this:

<a href="hello welcome xxxx site javascript:alert(2)"> 

i know start part onmouseover="alert(1)" i'm wondering whether it's possible within href tags in circumstance.

use:

<a href="javascript:alert('hello welcome xxxx site')"> 

using javascript: bad form in href. should using null anchor "#" , using onclick instead.

a better way is:

<a href="#" data-text="hello welcome xxxx site">...</a> 

...then using javascript hook event handler , access html5 data element.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -