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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:01:16+00:00 2026-05-30T10:01:16+00:00

Q: Should I change my href attributes to be relative or should I define

  • 0

Q:

Should I change my href attributes to be relative or should I define routes with leading slashes?
(Why do the Backbone docs suggest no leading slashes?)

Background:

The Backbone docs clearly suggest the following:

Note that you’ll want to avoid using a leading slash in your route definitions…

Now, I have these routes defined for a test:

var Router = Backbone.Router.extend({
  routes: {
    "index/": "logMe",
    "/clients/": "logMe"
  },

  logMe: function (page) {
    console.log(page);
  }
});

Calling router.navigate($(this).attr('href'), {trigger: true}); on click, the route is captured fine for /clients/ but not for index. (Adding a leading / to the index route fixes this).

The href="…" strings I’m passing are all starting from the domain root (href="/index/" & href="/clients/").

  • 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-30T10:01:20+00:00Added an answer on May 30, 2026 at 10:01 am

    The “href” value passed in is matched to the route property names. If your “href” values start with a slash, then your route properties have to as well.

    Note that in all the examples in the Backbone docs, the fragment values do not start with a slash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why won't the following C code compile? It seems like it should just change
I'm wondering if I should change the software architecture of one of my projects.
I am trying to create a status window which content(textbox) should change in a
I just starting reading about SEO and realized that I should change my GET
My problem is, I did coding for a sprite. It should change it should
It was recommended to me that, when using an IOC container, I should change
Which property should I change on Info.plist in order to configure the list of
I have program that has a variable that should never change. However, somehow, it
Should I use the change or textInput event to capture user input on a
How can i change a normal font to bold font, Here the text should

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.