Removing hashes from router

639 views
Skip to first unread message

Tiarnan Breffni

unread,
Mar 19, 2013, 11:43:49 AM3/19/13
to duran...@googlegroups.com
I'm investigating using Durandal for a new project, and I noticed that out of the box the router uses hashes in the url for navigation, e.g. /#home, /#dashboard, etc.  If possible I'd like to avoid using hashes, and just rely on HTML5 pushState which I believe SammyJS supports already.  My question is, what changes are required, if any, in the Durandal router so that hashes are not used?

Thanks!


Rob Eisenberg

unread,
Mar 19, 2013, 11:46:14 AM3/19/13
to Tiarnan Breffni, duran...@googlegroups.com
I'm not sure what changes are necessary yet. I think I will need to add a router setting to turn that on, plus change how I'm configuring Sammy in that case and do a few other things. I haven't yet investigated everything involved. If you want to go down this path, and have time to look into it. Please send me your findings. Pull requests are always welcome too....just be sure to preserve the existing behavior, so that the developer can choose which type of url they want.


On Tue, Mar 19, 2013 at 11:43 AM, Tiarnan Breffni <tbre...@gmail.com> wrote:
I'm investigating using Durandal for a new project, and I noticed that out of the box the router uses hashes in the url for navigation, e.g. /#home, /#dashboard, etc.  If possible I'd like to avoid using hashes, and just rely on HTML5 pushState which I believe SammyJS supports already.  My question is, what changes are required, if any, in the Durandal router so that hashes are not used?

Thanks!


--
You received this message because you are subscribed to the Google Groups "DurandalJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to durandaljs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Rob Eisenberg,
President - Blue Spire
www.durandaljs.com

Tiarnan Breffni

unread,
Mar 19, 2013, 11:58:57 AM3/19/13
to duran...@googlegroups.com, Tiarnan Breffni, r...@bluespire.com
Thanks for the feedback.  I'll spend some time investigating what changes are required and will let you know my findings.

Maximilian Beller

unread,
Mar 25, 2013, 1:34:49 PM3/25/13
to duran...@googlegroups.com

Hi, I also had a look into it and changed a few things to the router-js (attached). I did not really tested everything but the basic nav structure seems to work, if you also change the shell.html to use router.url instead of router.hash.
shell.html
router.js

ary...@getcodabox.com

unread,
Feb 5, 2016, 8:05:35 AM2/5/16
to DurandalJS, maximili...@shoplove.com
Maximilian,
One question.. The require to ../viewModel would be directed to shell.js?

Sammy should be loaded as a global library?

Thank you.
Reply all
Reply to author
Forward
0 new messages