I'm trying to get my head round running different scripts depending on whether the user has navigated back to a previously visited page on the site, or is visiting a new page.
The structure of my site is linear with links to the "next" page, i.e <a class="next" href="page2.html">next<a/>
and "back" links to the previous page, i.e <a class="back" href="index.html">back<a/>
. New pages will always open in the same tab.
Is there some way of creating an array and adding the current URL to it when the next button is clicked, and removing the current URL from the array when the back button is clicked. Then I could do something like 'if array contains current URL run back_function();'
If there is a way to achieve this through local or session storage that would be fine too.