Refresh BackboneJS at the same URL?

My current base application has a URL:

localhost/#users 

Is there a way to access localhost/#users , and in the localhost/#users URL, to refresh the page?

Currently, when I am in localhost/#users and I try

window.location.hash = #users or myBackboneRouter.navigate("users")

it does not start page refresh.

+8
javascript page-refresh
source share
4 answers

I think myBackboneRouter.navigate("users", {trigger: true}) will do what you want.

+6
source share

To refresh the same page in the base system, you should use

 Backbone.history.loadUrl(Backbone.history.fragment); 
+35
source share

I use these three lines of code to reload my base page:

 router.navigate(Backbone.history.fragment, true); Backbone.history.loadUrl( Backbone.history.fragment ); router.refresh(true); 

Or simply

 Backbone.history.loadUrl(Backbone.history.fragment); 
+2
source share

Why don't you use

 window.location.reload(); 

Either this, or call the render render () function.

-one
source share

All Articles