I'm trying to figure out how to set a unique identifier for Chrome tabs that satisfies the following conditions:
- Uniquely identifies each tab
- Remains unchanged for this tab between browser restarts (tabs restored by the session)
- Remains unchanged if the tab is closed and then reopened using the Undo Closed tab (Ctrl + Shift + T)
- Saved if duplication is duplicated.
I did some pretty aggressive research to find a complete solution, but it doesn't seem to do anything like that. Here are the methods I tried, in order of increasing efficiency:
- Use Chrome provided that tab.id: is not saved between browser sessions or closing / unsealing
- Put GUID in cookies: not unique for each tab, only for domain / URL
- Put the GUID in localStorage: saved between browser sessions and closed / canceled, but not unique for each tab, only for the domain
- Put the GUID in sessionStorage: unique to each tab, retained by closing / undoing, unique to duplicate tabs, but destroyed between browser sessions.
- Using identifiable attributes of a web page document as a unique key: this is the best approach I've found so far. The key can be created using the content of the following script:
[location.href, document.referrer, history.length].
, , URL-, . /- / . "" , , : , , http://www.google.com, ( ).
"put GUID in sessionStorage" / . .
, , Chrome , , , , "sibling" ( ). , . , Chrome . , , .
? , GUID GUID, ( ) close/undo-close, , .