The idea is use the content script as a bridge between your web page and the background script. Let's get the following code put in the background:
- chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
- alert("message received");
- });
- chrome.windows.create({
- type : 'popup',
- url : "http://yoursite.com/page.html",
- type: "popup"
- }, function(newWindow) {
- });
Read full article from Send message from web page to chrome extension's background script
No comments:
Post a Comment