В моем background.js
chrome.tabs.onUpdated.addListener(function(tabId, info, tab) {
if (tab.url !== undefined && info.status == "complete") {
chrome.tabs.query({active: true, currentWindow: true, status: "complete"}, function (tabs) {
console.log(tabs);
chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello"}, function (response) {
console.log(response.farewell);
});
});
}
});
Мой manifest.json
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": [
"content_script.js"
],
"run_at": "document_end"
}
Мой «content_sciprt.js» работал после «background.js». поэтому я не могу получить ответ.
Но после того, как я добавил
info.status=="complete"
, status: "complete"
"run_at": "document_end"
в своем манифесте .json Он отлично работает