Skip to content Skip to sidebar Skip to footer

Working Between Popup And Background Chrome Extension

I am trying to set a variable in popup window, labeled i and then send it to the background page. I believe that I can put the variable in as the 'request', but I might be wrong a

Solution 1:

You should call chrome.extension.getBackgroundPage function to get a reference to the window object of the background page. Here is an example where setIValue function is defined in the background page.

var i = 0, bgPage = chrome.extension.getBackgroundPage();
function start(){
    alert("working");
    bgPage.setIValue(i);        
}

Post a Comment for "Working Between Popup And Background Chrome Extension"