我已经创建了扩展程序,当我更改标签时,我正在使用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
你能帮我解决一下吗?
谢谢...