How to fix TypeError: browser is not defined?
How to fix TypeError: browser is not defined?
我对 onclick 浏览器操作有疑问。
一直显示 TypeError: browser is not defined if I do put in try catch
尝试手动插入 firefox 控制台,但仍未定义是否成功。
使用火狐 55。
如何克服这个问题?
console.log("Start 1")
function run(){console.log(1)}
browser.browserAction.onClicked.addListener(run);
var interval1Id = setInterval(function(){
var id = document.querySelector(".myclass").id
document.getElementById('m1).contentWindow.document.getElementById(id).click();
var newDate = new Date();
console.log("Function executes at : " +newDate )
},10000);
清单
{
"applications": {
"gecko": {
"id": "at@ex.com",
"strict_min_version": "52.0"
}
},
"browser_action": {
"default_icon": {
"18": "icons/btn18.png",
"38": "icons/btn18.png"
},
"default_title": "Whereami1?"
},
"manifest_version": 2,
"name": "FF 1a",
"version": "1a",
"description": "Refresh",
"background": {
"scripts": ["b.js"]
},
"content_scripts": [
{
"matches" : ["https://*/*"],
"js": ["scr.js"]
}
],
"permissions": ["webNavigation","tabs","notifications","activeTab"],
"web_accessible_resources": ["icons/btn18.png"]
}
Output of background script goes to specific Debug page, not to output of firefox console . Extensions-> Debug Extension -> Allow debugging-> Debug on extensions. New console outputs, where everything comes to display
Browser variable only supported in Debug console, not in developer tools console
我对 onclick 浏览器操作有疑问。 一直显示 TypeError: browser is not defined if I do put in try catch 尝试手动插入 firefox 控制台,但仍未定义是否成功。 使用火狐 55。 如何克服这个问题?
console.log("Start 1")
function run(){console.log(1)}
browser.browserAction.onClicked.addListener(run);
var interval1Id = setInterval(function(){
var id = document.querySelector(".myclass").id
document.getElementById('m1).contentWindow.document.getElementById(id).click();
var newDate = new Date();
console.log("Function executes at : " +newDate )
},10000);
清单
{
"applications": {
"gecko": {
"id": "at@ex.com",
"strict_min_version": "52.0"
}
},
"browser_action": {
"default_icon": {
"18": "icons/btn18.png",
"38": "icons/btn18.png"
},
"default_title": "Whereami1?"
},
"manifest_version": 2,
"name": "FF 1a",
"version": "1a",
"description": "Refresh",
"background": {
"scripts": ["b.js"]
},
"content_scripts": [
{
"matches" : ["https://*/*"],
"js": ["scr.js"]
}
],
"permissions": ["webNavigation","tabs","notifications","activeTab"],
"web_accessible_resources": ["icons/btn18.png"]
}
Output of background script goes to specific Debug page, not to output of firefox console . Extensions-> Debug Extension -> Allow debugging-> Debug on extensions. New console outputs, where everything comes to display Browser variable only supported in Debug console, not in developer tools console