I send something to active Tab in my chrome extension. But I have small problem, becouse when I opend a new empty Tab with start webpage/open seetings, or chrome://extensions.
The background script extension send a error:
Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
Anyone know how to fix this? How to get the ID of a new blank card or what to do in the "if" to avoid sending a message to the card
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
if (tabs[0].id != null) {
chrome.tabs.sendMessage(tabs[0].id, { msg: "msg" }, function(response) {
});
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…