Search code examples
javascriptgoogle-chrome-extensionbrowser-actionrapportive

browserAction on chrome extension to embed content on web page (like Rapportive)


I want to build a Chrome extension that shows some content embedded when a specific website is displayed. Exactly the same as Rapportive on Gmail.

Seems that browserAction only enables me to show that content as a popup, not embedded on the webpage. How can I do that?

How can I restrict it to a single URL?


Solution

    1. To embed contents on the web page, see Content Scripts for more details. You could declare your customized scripts/css into current page or use Programming injection to include them
    2. To restrict it to a single URL,
      • you could achieve that by specifying matches field for content scripts
      • Or if you want to dynamically inject your scripts, you could determine whether to inject by detecting current tab url. To detect the url, there are many ways to achieve that, for example, check it in the handler of chrome.tabs.onUpdated