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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -