0

I want to use hashes in my urls. when i use the code below, the url goes to kart/:nid but not #kart/:nid as i want it to. I have not enabled pushState:true in my code so that should not be the problem.

Backbone.history.navigate('#kart' + "/" + this.model.get("nid"), { trigger: true});

When i remove the wildcard from the function, the url keeps the hash going to "#kart".

Why is the wildcard messing up this?

Appreciate any help!

Stinis87
  • 140
  • 3
  • 14

2 Answers2

0

A couple of things come to mind. Make sure you aren't explicitly setting {hashChange: false} in your code.

If you look at the documentation for navigate, you'll notice they're not explicitly specifying the hash. So try this instead

Backbone.history.navigate( "kart/" + this.model.get("nid"), { trigger: true} );

Bart Jedrocha
  • 11,450
  • 5
  • 43
  • 53
  • did not make any difference unfortunately.. But the problem is not spesific to the navigate function. If i write #kart/10 in the url address bar and hit enter, it automatically goes to kart/10 instead. Can i somehow force it to go to #kart/10? Although it fires the correct route function, i still want it to keep the hash because if i refresh one more time when the url is without the hash, it does not call the correct route – Stinis87 Dec 06 '15 at 17:09
0

Thanks for helping guys! i found that the culprit was jquery mobile

Stinis87
  • 140
  • 3
  • 14