I'm writing a Quasar BEX browser addon and have some data in chrome.storage.local
(and Vuex; I'd like to use a local database for datastorage in the future if possible) that should be tied to a specific tab and remain linked to it even after restarting the browser. A specific tab should display specific data even after a browser restart (just like normal tabs do when restoring a browser session).
To associate specific data with specific tabs I need a unique identifier of the tab that persists or can be persisted across browser restarts.
The tabId
is reset after each browser restart and sessions.setTabValue()
also only uses tabId.
This doesn't work here because index is not unique either / reset after browser restart and that tab "fingerprint" (and url) should usually be the same for all of the BEX tabs.
The only idea I have for how this could be solved is changing the URL by appending a UID after a hash (like url#some-id). However, changing the URL didn't work by setting document.location.href or window.location or window.location.hash (in a background-hooks method of the Quasar BEX) – it stays the plain extension url in the URL address bar and only changes those variables (so if I were to close the browser the URL is unchanged). window.history.pushState({}, null, newUrl);
didn't change the URL in the address bar either. Edit: maybe the URL is changed and persists after a restart but doesn't display in the address bar for extension URLs?
The URL is the extension URL (it starts with moz-extension://).