我已经创建了扩展程序,并且chrome.tabs.onActivated.addListener
在更改选项卡时用来调用这些函数,但是我收到错误消息:
1. Uncaught TypeError: Cannot read property 'style' of null
2. Uncaught Error: Error connecting to extension onpcobifgmiammnghkcebnabklebagnb
资源:
document.getElementById('login_form').style.display="none";
document.getElementById('result').style.display="";
var username = localStorage.getItem('username');
var logo = localStorage.getItem('logo');
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {req: localStorage.getItem('token'), token: 'token',ext: extension}, function(response) {
//console.log(response.farewell);
});
//chrome.tabs.reload(tabs[0].id);
});
上面提到的是我得到第一个错误的代码。我试图用 if 条件删除错误,但它给出了错误提示
Uncaught TypeError: Cannot call method 'query' of undefined
你能帮我解决这个问题吗?
谢谢 ...