In a SPA, using a navigation framework such as Sammy.js, how could I use in page named anchors for in-page navigation?
e.g. Say I have a route like localhost/myapp/#/somerecord/1
where the application loads somerecord with id = 1.
However somerecord is really complicated and long. I want to be able to jump to a certain section using a named anchor.
Say an article element is defined like <article id=section-d> ... </article>
and I just link to like <a href=#section-d>Section D</a>
it technically works, but the URL reads like localhost/myapp/#section-d
, this breaks the navigation stack. Hitting the Back button takes me back to localhost/myapp/#/somerecord/1
and without jumping back to the top.
The preferred action would be to either jump back to the top or to the previous page. Any ideas on how to accomplish this?