Javascript &引用;无法读取属性';查询';“未定义”的定义;Chrome扩展名content.js文件
这是我的密码。我补充说Javascript &引用;无法读取属性';查询';“未定义”的定义;Chrome扩展名content.js文件,javascript,jquery,google-chrome,Javascript,Jquery,Google Chrome,这是我的密码。我补充说 chrome.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) { // and use that tab to fill in out title and url var tab = tabs[0]; console.log(tab.url); alert(tab.url); }); 到manifest.json 每当我尝试加载网页时,它都会记录错误“无法读取未定义的属性‘查询”
chrome.tabs.query({
active: true,
lastFocusedWindow: true
}, function(tabs) {
// and use that tab to fill in out title and url
var tab = tabs[0];
console.log(tab.url);
alert(tab.url);
});
到manifest.json
每当我尝试加载网页时,它都会记录错误“无法读取未定义的属性‘查询”
,而不是提醒url
我不知道为什么。请帮助,谢谢。“…但是,内容脚本有一些限制。它们不能:使用chrome.*API,除了:
扩展
,i18n
,运行时
,存储
”,所以我把它放在background.js中了?如何使它在我每次访问页面时都提醒url?@Andreas本教程是错误的:我不知道,我还没有构建扩展。这只是一个简短搜索的结果。。。
"permissions": [
"tabs"
],