Link to function instead of website
I have made a contentscript which "injects" the following into a website:
< a href="somewebsite.html">mytext< /a>
The trouble I'm facing is th开发者_开发问答at I want to link it to a function in my chrome extension instead. Something like:
< a href="mychromeextensionfunction">mytext< /a>.
How would I manage to do that, Is it even possible to link to a chrome extension function?
You can't do that through the href
attribute; you need the onClick
attribute.
That explains it, Thanks for putting me in the right direction : )
Here's a sample code of how you could do it.
link_dom.onclick=function (evt) { alert('hello'); }
精彩评论