Answer the question
In order to leave comments, you need to log in
How to get new open tab link for extension in Google Chrome?
There is an extension for Google Chrome. it contains a script that is executed when a button is pressed in the installed extension in the browser. The script gets the current link of the page where the extension is running and prints the link to the console.
document.addEventListener('DOMContentLoaded', function() {
var checkPageButton = document.getElementById('checkPage');
checkPageButton.addEventListener('click', function() {
chrome.tabs.query({active:true},function(tabsArray) {
var tab = tabsArray[0];
var tabUrl = tab.url;
console.log(tabUrl);
});
}, false);
}, false);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question