18 lines
590 B
JavaScript
18 lines
590 B
JavaScript
browser.tabs.onActivated.addListener((activeInfo) => {
|
|
browser.tabs.executeScript(tabId, {
|
|
code: 'document.documentElement.outerHTML'
|
|
}).then(result => {
|
|
const html = result[0];
|
|
fetch('http://localhost:3000/notify', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({ html })
|
|
}).catch(err => {
|
|
console.error('Error sending HTML:', err);
|
|
});
|
|
}).catch(err => {
|
|
console.error('Error fetching HTML:', err);
|
|
});
|
|
});
|