Vis4Sense / HistoryMap

http://sensemap.io
45 stars 7 forks source link

Manually open a tab and type in the url will have the lasted opened tab as tabOpenerId #134

Closed kaidatavis closed 6 months ago

kaidatavis commented 7 months ago

The desired behaviour is to create a new tree in this case.

kaidatavis commented 7 months ago

It seems that the 'openerTabId' is buggy.

kaidatavis commented 7 months ago

One option is to use the chrome history API's getVisits methods returns a VisitItem that includes a transition (TransitionType). The value would be 'typed' if the URL is entered manually.

kaidatavis commented 7 months ago

The other option is to use the chrome webNavigation API. This seems a more comprehensive option as it also reports page redirection (client or server) and the loading of the subframes within a page.

It seems that onCommitted is the event to watch for page update.

I also tried onHistoryStateUpdate. I thought it would be triggered every time an entry is added to the chrome history, but the actual behaviour is a bit different.

kaidatavis commented 6 months ago

The implementation now uses the history API to check how the url is updated, e.g., by clicking a linking or manually typed in. tabOpenerId is only used when a linked is opened in a new tab.