1
我的Chrome包装应用程序有2个JavaScript文件。
1. background.js是通过manifest.json的称为主JavaScript文件我可以在Chrome Packaged App的背景页面调用变量或函数吗?
var foo = 'sss';
function bar(a,b) {
return a+b;
}
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html', {
bounds: {
width: 500,
height: 300
}
});
});
2. app.js是的index.html控制器
问:我可以叫变量“foo”或函数“bar”from background.js in app.js?
PS。或者有任何解决方案来传输页面之间的值,如chrome.storage?
可能重复(HTTP:/ /stackoverflow.com/questions/4700254/how-do-i-get-data-from-a-background-page-to-the-content-script-in-google-chrome) –