【发布时间】:2018-03-27 17:21:06
【问题描述】:
我查看了关于带有清单版本 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,我该如何获取它?
【问题讨论】:
标签: javascript google-chrome google-chrome-extension