Keep state of extension in first tab for all tabs

65 views
Skip to first unread message

Jordan Fitch

unread,
Feb 27, 2025, 1:51:59 PM2/27/25
to Chromium Extensions
I'm sure this has been asked so if someone can point me in the correct direction.

I have an extension that popups a login page. The user can then login and do what they need to do. However when a new tab is opened it goes back to the login screen on the new tab. Is there a way to keep the state of the first tab amongst all tabs? Or possibly just keep one instance across all tabs. 

Hopefully that makes sense.
Thanks,

woxxom

unread,
Feb 27, 2025, 5:35:31 PM2/27/25
to Chromium Extensions, Jordan Fitch
Save the state in storage, read it at the beginning and then show/hide DOM elements accordingly. You can save it both to localStorage for easy synchronous access in the tab and to chrome.storage.local to read it in the background script.
Reply all
Reply to author
Forward
0 new messages