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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -