Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7084141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:15:53+00:00 2026-05-28T07:15:53+00:00

pushState support was introduced with Backbone.js’ version 0.5 update. From the backbone documentation :

  • 0

pushState support was introduced with Backbone.js’ version 0.5 update.

From the backbone documentation:

Note that using real URLs requires your web server to be able to
correctly render those pages, so back-end changes are required as
well. For example, if you have a route of /documents/100, your web
server must be able to serve that page, if the browser visits that URL
directly. For full search-engine crawlability, it’s best to have the
server generate the complete HTML for the page … but if it’s a web
application, just rendering the same content you would have for the
root URL, and filling in the rest with Backbone Views and JavaScript
works fine.

This may seem like a trivial question, but I’m wondering if anyone can help me with some specific (preferably express) node.js server code. How should I go about handling these routes? I’m a little confused.

Here’s the relevant excerpt from my app’s router module:

var Router = Backbone.Router.extend({
    routes: {
        '': 'index',
        'about': 'about'
    },
    index: function() {
        indexView.render();
    },
    about: function() {
        aboutView.render();
    }
});

var initialize = function() {
    var router = new Router;
    Backbone.history.start({ pushState: true });
}

return {
    initialize: initialize
};

I only have a top-level route and a route for an about page here. So how should I set up a node server that will allow me to navigate to:

domain.com
domain.com/about
domain.com/#/about // <- for browsers that don't support pushState
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:15:54+00:00Added an answer on May 28, 2026 at 7:15 am

    Explanation

    First, you need to know that domain.com/#/about will call the ‘/’ route of your server because it doesn’t read the # fragment. Your server will render the base of your Backbone.js application and Backbone will trigger the ‘about’ route.

    So, you need to declare two routes in Express JS:

    • /
    • /about

    Code

    app.get('/', function(req, res) {
        // Trigger the routes 'domain.com' and 'domain.com/#/about'
        // Here render the base of your application
    });
    
    app.get('/about', function (req, res) {
        // Trigger the route 'domain.com/about'
        // Here use templates to generate the right view and render
    });
    

    I recommend you 3 links for SEO compatibility with Backbone.js by Derick Bailey:

    • SEO And Accessibility With HTML5 PushState, Part 1: Introducing PushState: http://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-1-introducing-pushstate/
    • SEO And Accessibility With HTML5 PushState, Part 2: Progressive Enhancement With Backbone.js: http://lostechies.com/derickbailey/2011/09/26/seo-and-accessibility-with-html5-pushstate-part-2-progressive-enhancement-with-backbone-js/
    • SEO And Accessibility With HTML5 PushState, Part 3: The Video: http://lostechies.com/derickbailey/2011/10/06/seo-and-accessibility-with-html5-pushstate-part-3-the-video/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that IE does not support pushState, but I want a way for
I'm using pushState to create meaningful urls for ajax content on my site. I
I'm trying to prevent full page reloads using Backbone's pushState. When I call navigate()
What's the point of using the History API if the URLs that it creates
I want to update the URL using window.location.hash or history.pushState . What are the
Only Internet Explorer is not working (I happen to be using version 8, but
I'm using jQuery and PHP, I have a problem with history.pushState . When I
I am loading data in the web page via ajax, and using pushstate and
I have a page that contains some JS to update the browser history (
I see that Lifehacker is able to change the url while using AJAX to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.