You can send messages to tabs only by their id .
In this case, you can get a list of tabs with a specific url , then go through them, determining whether to send a message or not.
For this, we form the corresponding queryInfo object (the first parameter):
chrome.tabs.query({url: "http://www.example.com/*"}, function (tabs) { if (tabs.length != 0) { for (var i = 0; i < tabs.length; i++) { // Определить условие можно, или сразу всем слать chrome.tabs.sendMessage(tabs[i], {greeting: "hello"}); } } });
Get all the packages with the specified url in the current window.
I note that you can send as one url and an array with url
Go through them and send messages by specifying their id.
The full list of parameters for the query function is presented here.
UPD : about "permission": ["tabs"]; do not forget.