I would like to make a chrome extension that will fire when I move my cursor over an email address that is on the screen. All the searches I do return results of existing extensions in the chrome store. I would like to know which extension method and ideal see an example of how to capture the email address and send that as a parameter to a custom API.
Asked
Active
Viewed 46 times
1 Answers
0
The question is a bit broad, but a high-level overview would be:
- Inject a content script in all pages you want to monitor;
- In a content script, identify all email addresses in the DOM
(and possibly monitor for new dynamic content); - Wrap addresses in
<span>
if required, add listeners to appropriate events ("mouseover"
?"mouseenter"
?); - Do what you want when the listener fires: inform the main script, inject some HTML as your UI in the page, communicate with your API, etc.
-
Use `mouseenter` instead of `mouseover` for performance. For an efficient method of tackling (3), see e.g. https://stackoverflow.com/questions/12209628/is-there-a-chrome-extension-to-add-mailto-links-to-email-addresses – Rob W Dec 09 '14 at 12:16
-
I know it is a bit broad, always a challenge to keep it out of the weeds of my specific situation. Your high-level overview I think will point me in the right direction. If I get a working sample I'll update with a link. – Lloyd Dec 09 '14 at 17:32