18 lines
377 B
JavaScript
18 lines
377 B
JavaScript
function copyUrl() {
|
|
document.navigator.clipboard.writeText(tab.url).then(
|
|
function () {
|
|
console.log(`Copied URL: ${tab.url}`);
|
|
},
|
|
function (err) {
|
|
console.error(`Something went wrong..`, err);
|
|
},
|
|
);
|
|
}
|
|
|
|
chrome.action.onClicked.addListener((tab) => {
|
|
chrome.scripting.executeScript({
|
|
target: { tabId: tab.id },
|
|
func: copyUrl,
|
|
});
|
|
});
|