I am creating an extension for Chrome. I want to show alert () with the URL of the page when the user moves from one tab to another or when the user enters a new URL in the tab.
This does not work:
chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab) { alert(changeInfo.url); }); chrome.tabs.onActivated.addListener(function(object activeInfo) { // also please post how to fetch tab url using activeInfo.tabid });
Remove integer , object and Tab in function signature.
integer
object
Tab
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { alert(changeInfo.url); }); chrome.tabs.onActivated.addListener(function(activeInfo) { // how to fetch tab url using activeInfo.tabid chrome.tabs.get(activeInfo.tabId, function(tab){ console.log(tab.url); }); });
Source: https://habr.com/ru/post/918755/More articles:where op_addition in [int, float, double] - c #Debugging jQuery event in Chrome - jqueryiOS: creating a 3D compass - iosGet parent recursions in the correct order to delete from MySQL table - phpgit pull and git click once - gitWhat are the correct Cloudwatch / Autoscale settings for extremely short traffic on Amazon Web Services? - amazon-web-servicesGoogle Drive SDK - changing inventory permissions - google-drive-sdkGoogle Drive File Sharing Permissions - google-drive-sdkFind the software path of an external USB drive? - androidHow to get .ipa file from PhoneGap for iOS? - iosAll Articles