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 6840097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:47:57+00:00 2026-05-26T23:47:57+00:00

Using Backbone, is it possible for me to get the name of the current

  • 0

Using Backbone, is it possible for me to get the name of the current route? I know how to bind to route change events, but I’d like to be able to determine the current route at other times, in between changes.

  • 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-26T23:47:58+00:00Added an answer on May 26, 2026 at 11:47 pm

    If you have instantiated a Router in your application, the following line returns the current fragment:

    Backbone.history.getFragment();
    

    From the Backbone.js documentation:

    ”
    […]
    History serves as a global router (per frame) to handle hashchange events or pushState, match the appropriate route, and trigger callbacks. You shouldn’t ever have to create one of these yourself — you should use the reference to Backbone.history that will be created for you automatically if you make use of Routers with routes.
    […]”

    If you need the name of the function bound to that fragment, you can make something like this inside the scope of your Router:

    alert( this.routes[Backbone.history.getFragment()] );
    

    Or like this from outside your router:

    alert( myRouter.routes[Backbone.history.getFragment()] );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Backbone.js and sometimes the views events do not get bound correctly. I
Using backbone.js, is it possible to chain Url routes? if I have something like
I'm using backbone for a current project. I was wondering if it's possible to
I'm trying to follow this Rails/Backbone example but they are using erb and not
Using Backbone I can fetch the Collection like below and render a Backbone View
I'm using backbone.js with websockets and sending data to the server based on events.
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using Javascript, is there a standard way to get the absolute path of an
Using a site like StackOverflow as an example: I have a table of users,
I'm using Backbone along with Mustache, how can I detect when a view is

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.