On a website that has several sections and subsections on one page, I was thinking about implementing scrolling to a new section as a new browser history event. The main reasoning for doing so is to allow for linking to a specific section of the page by keeping the URI in sync to the section currently viewed by the user. I.e. on a page
http://mypage.com/apage/ scrolling to the second section of the page, the browser address would change to
http://mypage.com/apage/section2/ without any page refresh, and also enter this new URI as a history point to the browser's history.
Similarly, I have a lightbox overlay in some of the sections. I want to register a history event for having the overlay opened with a specific content. Here, too, the reasoning is that I want users to be able to link to something like
http://mypage.com/apage/section3/subsection2/lightboximage4/ and people clicking this potentially shared link open the page scrolled to section3, subsection2, with lighboximage4 open.
Is the entering of history events like scrolling to a section or opening an lightbox overlay confusing? I imagine a scenario like someone browsing different pages, then scrolling to a section and clicking
back to return to the previous page - with the result of scrolling up one section, because that was the last history event.
Do the advantages of well structured URI's outweigh the potentially harmful effect on usability, or am I worrying about a problem that is none?
What other situations or events could be equally problematic to programmatically insert into the browser history?
Should I detect history
back events and internally redirect to user as far back in the history to what I deem the real last history event (i.e. actual different page view or top section change)?