我在清单版本 2 中查看了有关 Chrome 扩展的其他全局变量问题,但一无所获。
假设我有 2 个文件:
// content.js
var myVariable = myVariable(someDiv);
var myVarWithGlobe = VarWithGlobe.fromVariable(myVariable);
和
// VarWithGlobe.js
var withGlobe = withGlobe || { };
withGlobe.WithGlobe = (function(global) {
var myLocalVar = global.myVariable;
....
WithGlobe.fromVariable = WithGlobe;
它们都被添加到web_accessible_resources、content_scripts但我无法访问第二个文件中的 global.myVariable,因为它是未定义的。
如果我不允许更改 VarWithGlobe.js,我怎么能得到它?