Answers for "communicate from extension to background page"

0

communicate from extension to background page

var port = chrome.extension.connect({
      name: "Sample Communication"
 });
 port.postMessage("Hi BackGround");
 port.onMessage.addListener(function(msg) {
      console.log("message recieved" + msg);
 });
Posted by: Guest on April-27-2021
0

communicate from extension to background page

chrome.extension.onConnect.addListener(function(port) {
      console.log("Connected .....");
      port.onMessage.addListener(function(msg) {
           console.log("message recieved" + msg);
           port.postMessage("Hi Popup.js");
      });
 })
Posted by: Guest on April-27-2021

Code answers related to "communicate from extension to background page"

Browse Popular Code Answers by Language