I am developing a chrome extension.
In background script, I create a popup window (popup.html) and I want to pass a value to a function in popup.js (which is embedded in popup.html).
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.windows.create({
url: chrome.runtime.getURL("html/popup.html"),
type: "popup"
}, function(win) {
// Do sth after window opens
win.funcionInPopupJS(value);
});
});
An error message is shown. Error handling response: TypeError: win.funcionInPopupJS is not a function at background.js
Why? Besides, how to call the function in popup.js?