-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
24 lines (21 loc) · 820 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
document.addEventListener('DOMContentLoaded', () => {
chrome.tabs.query({}, (tabs) => {
const list = document.getElementById('tabs-list');
// If no tabs are found, show a message
if (!tabs || tabs.length === 0) {
list.innerHTML = '<li>No tabs found</li>';
return;
}
// Create a list item for each tab, showing the URL as the link text
tabs.forEach((tab) => {
const listItem = document.createElement('li');
const link = document.createElement('a');
link.href = tab.url;
// Instead of using the page title, display the URL
link.textContent = tab.url;
link.target = '_blank'; // Opens the link in a new tab
listItem.appendChild(link);
list.appendChild(listItem);
});
});
});