millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Remove hashtag for frontend clients #126

Closed martinsookael closed 9 years ago

martinsookael commented 9 years ago

Thank you for building Crossroads. I looked long and wide for a proper routing for Single Page Apps and so far Crossroads has been exactly what it promises.

I'm using it with: https://github.com/jayJs/jay and https://github.com/jayJs/node-jay

Signals and Hasher are also involved.

Question: Current url: "www.domain.com/#/post/first-post" How I'd like it to be: "www.domain.com/post/first-post"

What's the best strategy for achieving this?

millermedeiros commented 9 years ago

you would need to listen to popstate and use pushState to set the URL instead of location.hash. see MDN documentation about the History API: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history