chrome.tab.onactivated

后端 未结 1 1027
慢半拍i
慢半拍i 2021-01-21 10:59

Can someone please show me how to use the chrome.tabs.onActivated.

I would like to refresh the tab that is clicked/activated if the url equals: www.example.

相关标签:
1条回答
  • 2021-01-21 11:26

    Firstly, be sure to put "tabs" permission in your manifest.json file. Then, use chrome.tabs.onActivated in your background page script. Each time this event will be called you will get activeInfo object containing currently active tab ID. Having this ID you can fetch the tab and see what URL is it set to. When you are certain that this is a tab you are looking for (URL matches) you can reload it.

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