/* Assign `notify()` as a listener to messages from the content script. */ chrome.runtime.onMessage.addListener(notify); /* Log that we received the message. Then display a notification. The notification contains the URL, which we read from the message. */ function notify(message) { console.log("background script received message"); chrome.notifications.create({ "type": "basic", "iconUrl": chrome.extension.getURL("icons/link-48.png"), "title": "You clicked a link!", "message": message.url }); }