javascript - Chrome Extensions: How does A Browser Action popup communicate with the active tab? -
i want script running on browser action popup information current active tab when invoked. it's not clear me how communicate between two. need content script running on active tab , chrome.tabs.sendmessage()
requesting info it? permissions should ask for?
yes, communication between content-script , other scripts (background, browseraction, pageaction) goes via messages. so, on each side have kind of code:
chrome.runtime.onconnect.addlistener(function(port) { port.onmessage.addlistener(function(request) { // process request // reply port.postmessage(data) if needed }; };
Comments
Post a Comment