I'm trying to write a Chrome extension that will display the URL of the page the user is on and send it to the server for a response.
So far I have tried to use chrome.tabs.getCurrent(), but I get uncaught TypeError in the getCurrent object.
chrome.tabs.getCurrent()
Is there an easy way to do this?
You get an error because getCurrent returns the script tab, not the selected tab.
You should probably use getSelected as indicated by serg
Any reason you don't want to use getSelected()?
getSelected()
chrome.tabs.getSelected(windowId, function(tab) { alert("current:"+tab.url); });
getSelected . :
chrome.tabs.query({active: true}, function(tab) { // Do stuff here }
Source: https://habr.com/ru/post/1758514/More articles:What is the difference between a string and a string? - c #Настройка шириныдля размещения элементов меню с помощью jQuery - jqueryVector sum in C ++ design strategy - c ++Why can't I compile this program other than CLR in VC ++ 2008? How to do it? - c ++Установка шириныдля размещения элементов меню - javascriptWhy I got "Access Denied". (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) "when creating a user in Active Directory - c #Authentication of WPF and WCF data services at the request level? - wpfRuby on Rails 3 InvalidAuthenticityToken with REST calls - restHow to create a SQL Server database from Visual Studio? - visual-studio-2010C #: How to use a text file that has been added to My project From 'add new items \ general' - c #All Articles