0

I'm trying to get a message from a content script, and then pass a message to a different content script / tab:

chrome.extension.onRequest.addListener(function (request, sender) {
  chrome.tabs.query({ url: "https://admin3.xxx.xxx.com" }, function (tab) {
    chrome.tabs.update(tab[0].id, { highlighted: true }, function () {
      chrome.tabs.sendMessage(tab[0].id, { whatsup: "Hello from background" });
      console.log(request);
    });
  });
});

I get the request from the first content script on tab 1 but tab 2 does not pick up the sendMessage?

  • 1. `{ article }` is not a valid js syntax. 2. where's the content script's onMessage listener? 3. What happens if you [debug the background page script](http://stackoverflow.com/questions/10081898/how-to-debug-google-chrome-background-script)? – wOxxOm Dec 15 '15 at 12:37
  • @wOxxOm `{ article }` IS valid JavaScript syntax. It is introduced in ES6 (aka ES2015) and is equivalent to `{article: article}` in ES5. – Rob W Dec 17 '15 at 12:50

0 Answers0