Answers for "get window url from a browser extension"

0

get window url from a browser extension

chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
  var tab = tabs[0];
  var url = new URL(tab.url)
  var domain = url.hostname
  // `domain` now has a value like 'example.com'
})
Posted by: Guest on October-18-2021

Code answers related to "get window url from a browser extension"

Code answers related to "Javascript"

Browse Popular Code Answers by Language