Questions tagged [backbone-routing]

Backbone.js is a JavaScript framework that provides structure to RESTful web applications. Backbone also includes URL fragment or History-based routing. This tag is for questions related to Backbone's routing system.

From the fine manual:

Web applications often provide linkable, bookmarkable, shareable URLs for important locations in the app. Until recently, hash fragments (#page) were used to provide these permalinks, but with the arrival of the History API, it's now possible to use standard URLs (/page). Backbone.Router provides methods for routing client-side pages, and connecting them to actions and events. For browsers which don't yet support the History API, the Router handles graceful fallback and transparent translation to the fragment version of the URL.

419 questions
4
votes
3 answers

Destroy Backbone views on route change

My view should be destroyed after the current route position is left. So in this schematic example the login view should be destroyed after the user entered his credentials: I tried to solve this by using Backbone.Router events: var Router =…
jantimon
  • 36,840
  • 23
  • 122
  • 185
4
votes
1 answer

Backbone Navigates to Base URL Immediately After Page Load

I've been facing this issue with Backbone routing and figured I'd spent enough time investigating: There are two urls at play here: / and /post/:id. The / page has links to various posts via /post/:id. When I click the post link, the post page…
threejeez
  • 2,314
  • 6
  • 30
  • 51
4
votes
2 answers

Anchors in links

Given: Tom — who has a modern browser which is pushState-enabled Fred — who has a browser which is not pushState-enabled a super.app web application powered by Backbone Tom browses to products/1 page where a #special-offer section exists. Does…
abernier
  • 27,030
  • 20
  • 83
  • 114
4
votes
1 answer

Backbone.js router using pushstate with XAMPP apache server on localhost

I'm trying to get backbone.js's router to work with my XAMPP apache server on localhost. I need to prevent apache from evaluating the directory paths that are supposed to go to the router and just forward everything to /test_backbone/index.html.…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
4
votes
1 answer

Routing.navigate vs document.location.hash

I have built a web app using backbone.marionette. When, from a Marionette.ItemView, I trigger the event document.location.hash: document.location.hash = '#tasks/' + this.model.get('id'); 1.a) it changes the URL 1.b) it triggers the appRoutes If I…
Lorraine Bernard
  • 13,000
  • 23
  • 82
  • 134
4
votes
2 answers

Backbone router failing to respect trigger=false option

Backbone.js provides a navigate(fragment, [options]) method for its Backbone.router objects, which does the following (per the documentation): Whenever you reach a point in your application that you'd like to save as a URL, call navigate in order…
Matm
  • 583
  • 1
  • 6
  • 17
4
votes
1 answer

What are some general strategies for versioning Web Apps for the end user?

I'm writing a web app and am wondering about future upgrades and how upgrading the webapp will affect the user experience. In particular, I was wondering how a company like Google approaches this problem. For example, I have seen several examples…
meecect
  • 549
  • 1
  • 6
  • 16
4
votes
2 answers

Prototyping: Simplest HTTP server with URL routing (to use w/ Backbone.Router)?

We're working on a Backbone.js application and the fact that we can start a HTTP server by typing python -m SimpleHTTPServer is brilliant. We'd like the ability to route any URL (e.g. localhost:8000/path/to/something) to our index.html so that we…
Dan
  • 9,912
  • 18
  • 49
  • 70
3
votes
2 answers

Invariant Violation: Target container is not a DOM element, when element is in the DOM

So I have a react app using the Backbone router, yet when I try to navigate on DOMContentLoaded, I get: Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element. I have tried stepping through the stack…
mattmattmatt
  • 965
  • 3
  • 15
  • 29
3
votes
1 answer

Default route in Backbone using routes property

I'm working with a Backbone project, and in our router we specify a default route at the end of the routes property: routes: { "things": "stuff", "*actions": "default" } From a bit of searching around, I've seen a couple of places, such as…
Shoaib
  • 561
  • 3
  • 11
3
votes
3 answers

Backbone router

I am trying to update the URL but not navigate the page when using tabs in backbone, so that a tab can be bookmarked, when I run this from my codebase it does nothing, app.Router.navigate('groups/teams', { trigger:false }); however if I run it in…
Cycs
  • 229
  • 1
  • 5
  • 15
3
votes
1 answer

How can we log backbone history stack list in javascript mobile application?

I am developing android hybrid app using the backbone js framework. Does anyone know how to log or alert backbone history stack items in jquery or javascript? Backbone.history function in backbone js. Help appreciated. Thanks
3
votes
3 answers

Backbone Routes with pushState on are not working when you refresh page

I have a simple router: Erin.Router = Backbone.Router.extend({ initialize: function() { Backbone.history.start({pushState: true}); }, routes: { '' : 'index', 'project/:img' :'project', }, index: function()…
Rchristiani
  • 424
  • 3
  • 18
3
votes
1 answer

Testing backbone router with jasmine and sinon. Cannot call the pushState.

I was following this question to test the router. My router is really simple: App.Router = Backbone.Router.extend({ routes:{ "": "index", "help": "help" }, help: function() {/* not really needed */ }, index:…
dierre
  • 7,140
  • 12
  • 75
  • 120
3
votes
2 answers

The backbone router isn't working properly

I'm building a simple backbone app that have 4 routes: home, about, privacy and terms. But after setting the routes I have 3 problems: The "terms" view isn't rendering; When I refresh the #about or the #privacy page, the home view renders after the…
swayziak
  • 353
  • 2
  • 7
  • 22
1 2
3
27 28