How to track the transition to a new page (not the tab) using the Chrome API?
I try this, but probably wrong:
chrome.windows.onCreated.addListener(function(win){ chrome.windows.get(win.id,{populate:true},function(tabwin){ setTimeout(function(){ //chrome.tabs.executeScript(tabwin.tabs[0].id,{code:"alert(JSON.stringify(window));",runAt:'document_idle'}); console.log('onCreated'); },500); }); }); Addition:
An error flies when we try to send messages: extensions :: schemaUtils: 113 Uncaught Error: Invocation of form tabs.sendMessage (integer) doesn’t match definition tabs.sendMessage (integer tabId, any message, optional object options, optional function responseCallback)
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { if(changeInfo.url != null) { console.log('изменилось '+changeInfo.url); console.log('tabId '+tabId); setTemer(tabId); } }); function setTemer(tabs_id){ setInterval(function(){ chrome.tabs.sendMessage(tabs_id), {greeting: "hello"}, function (response) { //console.log("ID - "+tabs); }; }, 6000); }