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

Using 'OR' and 'AND' in SQL Server -

c++ - NetBeans Remote Development with additional configuration -

visual studio - TFS will not accept changes I've made to a Java project -