Call a function in background from popup

Anonymous picture Anonymous · Mar 26, 2011 · Viewed 12.1k times · Source

Is there a way to call a function in the background script from the popup? I can't explain it much further than that question. It's not an error I'm having with what I'm trying to do but rather something I completely don't know how to do. I want to make it possible to click a button in the popup page that'll call a function defined in the background page.

Answer

Exception picture Exception · Dec 21, 2011

Try this

 var bgPage = chrome.extension.getBackgroundPage();
 var dat =  bgPage.paste(); // Here paste() is a function that returns value.