Trigger Chrome extension on new tab open

后端 未结 1 953
孤城傲影
孤城傲影 2020-12-28 19:12

I need to run Chrome extension when new tab is opened and html document is loaded.

Extension needs to check for new tab title and if it\'s equal to predefined s

相关标签:
1条回答
  • 2020-12-28 20:06

    To accomplish this first of all you will need to have a Background Page that will manage your extension state. You can read about it here: https://developer.chrome.com/extensions/background_pages

    Then in the background page script you will need to listen when the tab is created with this piece of code:

    chrome.tabs.onCreated.addListener(function callback)
    

    Here is documentation for this: https://developer.chrome.com/extensions/tabs#event-onCreated

    Hope this will help to solve your issue.

    0 讨论(0)
提交回复
热议问题