问题描述
chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab){
if(tab.url.indexOf('http')=='0' &&; changeInfo.status =='complete'){
alert(JSON.stringify(changeInfo));
}
});
我有这样的background.js,它几乎可以工作在%99但不是%100
无论何时我重新启动浏览器并在浏览器加载缓存中的所有内容时输入一个已访问的网页,它都不会触发此chrome.tabs事件
但有趣的部分是,当我从拨号速度点击相同的网站时,它不会从缓存中加载并调用选项卡。 action
根据
和
尝试使用中的webNavigation权限:
{
name:My extension,
...
permissions:[
webNavigation
,
...
}
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (tab.url.indexOf('http') == '0' && changeInfo.status == 'complete') {
alert(JSON.stringify(changeInfo));
}
});
i have such background.js it nearly works always %99 but not %100
whenever i restart my browser and enter an already accessed web page when browser loads all contents from cache it doesn't fire this chrome.tabs event
but the interesting part is when i click same website from dial speed it doesn't load from cache and calls the "tabs." action
According to https://developer.chrome.com/extensions/webNavigation
and
Try using the chrome.webNavigation.onTabReplaced event to catch this:
chrome.webNavigation.onTabReplaced.addListener(function (details) {
chrome.tabs.get(details.tabId, function(tab) {
console.log(tab.url);
}
}
Note: You'll need the "webNavigation" permission in the extension manifest:
{
"name": "My extension",
...
"permissions": [
"webNavigation"
],
...
}
这篇关于chrome.tabs.onupdated.addlistener不适用于缓存页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!