how to detect browser back and forward button clicks
I need to know when a visitor to my site is clicking the back or forward button. The reason is I have a "tabstrip" that hilites the currently selected tab and the target … (tuilleadh eolais)
I need to know when a visitor to my site is clicking the back or forward button. The reason is I have a "tabstrip" that hilites the currently selected tab and the target document is displayed in an iframe. If I click the back or forward buttons the page is updated with the last or next document in the iframe, but the tabstrip is not updated to reflect the change. Part of this is due to me not knowing how to update the tabstrip, but also because I don't know how to detect the back or forward buttons being clicked.
So I need to know how to detect those button clicks. Also, in researching this, I noticed that there seems to be an idea that you can't distinguish between the forward and back button, only that a button was clicked. That doesn't make sense given that each button has a specific action that is opposite of the other. I need to know the truth about this.
Finally, as much as I use only Firefox myself, I know there will be others who use other browsers. Is there any difference between detecting the back and forward buttons on other browsers compared to Firefox?
One of the pages I need this for is here
Edit 15 March 2022:
I had to fix the link because I had renamed the page when I finished the work on its layout. Also, since I asked this question I have realized another similar and sort-of related issue on a different page: https://wayneca.neocities.org/WebDesi.../TagList.html. The relation is that the back and forward buttons don't correctly reload the page. The difference is that this one is concerning named links.
When you click a link in the table on the left it correctly moves the document in the right table to the point where the matching id anchor is. But when you click the back or forward button the tables do not shift back to where they were on the page as reloaded. The back and forward buttons work fine if the link anchors and id anchors are not in tables.
I have been told about the history functions, but I have found no examples of using it to correct the issue in either of the above cases. Is someone here able to point me to examples of using the history to make a selected link reset back to where it was or reload a page with the last jump point being reset correctly?
Also, why does the named link thing work without tables but not with tables?