javascript - Creating a link that opens a popup on a Google Chrome Extension -
i have code transform words "test" on page links google. there way make clicking on these links open popup.html instead?
searchpattern = new regexp ("(test)", "gi"); var pagetext = document.body.innerhtml; document.body.innerhtml = pagetext.replace(searchpattern, "<a href='https://www.google.com/#q=$1'>$1</a>");
edit: ok have function instead of link, still not sure how call extension's popup.html through page's html code:
document.body.innerhtml = pagetext.replace(searchpattern, "<a class='popup'>$1$2$3</a>" + "<script>$('popup').click(function(e) {e.preventdefault();" + "});</script>");
Comments
Post a Comment