“Chrome -Erweiterung Get Current Registerkarte "” Code-Antworten

Chrome -Erweiterung Get Current Tab URL

chrome.tabs.query({currentWindow: true, active: true}, function(tabs){
    console.log(tabs[0].url);
});
flexflower

Rufen Sie die aktuelle Registerkarte vom Chrome -Erweiterungsentwickler ab

chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
    let url = tabs[0].url;
    // use `url` here inside the callback because it's asynchronous!
});
Horrible Herring

Chrome -Erweiterung Get Current Registerkarte "

chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
     // {active: true, currentWindow: true}: current tab of the active window
  	 // tabs parameter is an array holding objects providing access to url
     const activeTab = tabs[0];
     const activeTabId = activeTab.id; 
	 const activeTabURL = activeTab.url; 
     // do whatever you want with the above values
  });

// the following should be added to manifest.json for chrome extension
"permissions": [
        "tabs"
 ]
Wissam

Ähnliche Antworten wie “Chrome -Erweiterung Get Current Registerkarte "”

Fragen ähnlich wie “Chrome -Erweiterung Get Current Registerkarte "”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen