Currently, I am in the process of developing a single webpage (index.html). The navigation bar at the top includes links to hash references (DIV IDs). If JavaScript is enabled, clicking on these links triggers a JavaScript function with the onclick attribute. Subsequently, the links are suppressed. This JavaScript function prevents the link from leading to the hash reference and only displays the selected DIV while hiding others.
Is there a way to save the page state (which divs are hidden or visible) so that when a user bookmarks the page, their selection is preserved? Additionally, how can browser history be manipulated to achieve the same outcome?