diff --git a/public/content-script.js b/public/content-script.js index 76ac485..60ac93c 100644 --- a/public/content-script.js +++ b/public/content-script.js @@ -180,3 +180,15 @@ document.addEventListener('qortalExtensionRequests', async (event) => { } // Handle other request types as needed... }); + + +chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { + console.log({message}) + if (message.type === "LOGOUT") { + // Notify the web page + window.postMessage({ + type: "LOGOUT", + from: 'qortal' + }, "*"); + } +}); \ No newline at end of file diff --git a/src/background.ts b/src/background.ts index 9d0c8b4..8cfdf74 100644 --- a/src/background.ts +++ b/src/background.ts @@ -811,6 +811,12 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { // Handle error console.error(chrome.runtime.lastError.message); } else { + chrome.tabs.query({}, function(tabs) { + tabs.forEach(tab => { + console.log({tab}) + chrome.tabs.sendMessage(tab.id, { type: "LOGOUT" }); + }); + }); // Data removed successfully sendResponse(true); }