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

  • Home
  • SEARCH
  • 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 9210931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:11:08+00:00 2026-06-18T01:11:08+00:00

I am using the Backbone.js router to fire certain initialization methods when the user

  • 0

I am using the Backbone.js router to fire certain initialization methods when the user hits certain URL routes. So going to /posts/1 via a vanilla anchor tag should fire whatever callback is associated with /posts/:id in my Backbone router. This works fine in modern browsers when Backbone.history.start({ pushState : true }) is set. However, in IE, users who try to hit /posts/1 will be redirected to /#posts/1, which is just my home page with a meaningless hash string.

To be clear, I do not need pushState. I am not trying to push URLs to the browser history. I am just trying to read them, then fire a callback, which should be feasible in any browser.

Seems like simple functionality but I am stumped.

Thanks!

  • 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-06-18T01:11:09+00:00Added an answer on June 18, 2026 at 1:11 am

    I can answer my own question here. The type of functionality I needed here could be achieved the following way:

    var suffix_pattern = new RegExp('\/?' + config.history_root + '\/?','i');
    
    // if IE
    if (!Modernizr.history) {
    
        // initialize router/Backbone.history, but turn off route parsing,
        // since non-window.history parsing will look for a hash, and not finding one,
        // will break our shit.
        Backbone.history.start({ silent: true, hashChange: true });
    
        // convert any post-# elements to a standard URL to be parsed by our router
        var subroute = window.location.hash.replace('#', '/').split('?')[0],
               route = window.location.pathname.replace(suffix_pattern, '') + subroute;
    
        Backbone.history.loadUrl(route);
    } else {
        Backbone.history.start({ pushState: true, silent: true });
        Backbone.history.loadUrl(Backbone.history.getFragment().replace(suffix_pattern, '').split('?')[0]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Backbone.js and I have a router. this is my routes property
Using backbone.js, is it possible to chain Url routes? if I have something like
I have a Backbone.Router based myRouter, that calls certain set() methods based on the
I'm building one page application using Backbone's router to modify browser history. I don't
I am learning backbone routes. I just built a small app using backbone. But
Have done some working samples using Backbone Router, but is there a way to
I am using Backbone's router with pushState:true to handle my site's urls. Examples of
I'm using the router function in backbone.js and came across this problem. This may
I have a router setup like so: var AppRouter = Backbone.Router.extend({ routes: { /agents/:id:
I'm looking for a way to inspect a Backbone.Router and see what routes it's

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.