I'm working on an SPA, using crossroads.js for the client-side routing. Everything is working perfectly, with one exception.
I have one page within this SPA that is quite large, and I'd like to be able to use internal links, to provide a table of contents at the top. In the past, I've done something like this:
<ul>
<li><a href="#Introduction">Introduction</a></li>
<li><a href="#Chap1">Chapter 1</a></li>
<li><a href="#Chap2">Chapter 2</a></li>
<li><a href="#Chap3">Chapter 3</a></li>
</ul>
These would link to elements within the same page with the corresponding ID.
However, now that I'm using client-side routing, this doesn't seem work work as well. The page that this I'm using this on has a URL like:
http://myserver.com/#/Books/12/Full
Clicking one of the links above does move the page to the correct location on screen, but it changes the URL to:
http://myserver.com/#Chap2
Is there a standard way of handling internal links in an SPA, while preserving the URL?