0

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.

Lloyd
  • 1,395
  • 6
  • 20
  • 37

1 Answers1

0

The question is a bit broad, but a high-level overview would be:

  1. Inject a content script in all pages you want to monitor;
  2. In a content script, identify all email addresses in the DOM
    (and possibly monitor for new dynamic content);
  3. Wrap addresses in <span> if required, add listeners to appropriate events ("mouseover"? "mouseenter"?);
  4. 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.
Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206
  • 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