What I am trying to do is make an application that once the user has logged in, a session is started. The user then clicks on a ‘Record Journey’ button and then the user browses the web. Once they return to my page it will display the pages that they have just visited.
Would using html5 local-storage be the best option when trying to store the user’s page history? And does it even allow me to do this? If not, what alternatives are available?
Thank you in advance.
There’s no sane way to read the user’s history using JavaScript in a web page.
If your “application” is a browser extension, then this is possible, using one of the APIs as exposed by the environment (eg
chrome.history).When the “application” is used to track history on web pages you own, then that’s possible.
localStoragewould indeed be a good choice, since the persistent data does not add overhead to web requests. Don’t forget that the the storage size is limited.