My current backbone application has a url:
localhost/#users
Is there a way to access localhost/#users
while at the URL localhost/#users
so it refreshes the page?
Currently, when I am at localhost/#users
and I try
window.location.hash = #users
or myBackboneRouter.navigate("users")
it does not trigger a page refresh.
To refresh same page in backbone, you have to use
Backbone.history.loadUrl(Backbone.history.fragment);
I think myBackboneRouter.navigate("users", {trigger: true})
will do what you want.
I use these three line of codes to reload my backbone page:
router.navigate(Backbone.history.fragment, true);
Backbone.history.loadUrl( Backbone.history.fragment );
router.refresh(true);
OR Simply
Backbone.history.loadUrl(Backbone.history.fragment);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With