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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:12:56+00:00 2026-06-14T12:12:56+00:00

I have struggled with this for quite a long time. I’m using Backbone.js along

  • 0

I have struggled with this for quite a long time. I’m using Backbone.js along with Require.js. I’m trying to tell Backbone to display a specific view according to the current URL (not hash). My code looks like this:

define(['jquery','underscore','backbone', 'views/manage_pages'], function($, _, Backbone,  ManagePages) {
  var AppRouter = Backbone.Router.extend({
    routes:{
      '/new_page': "showPageForm",
      '/edit_page': "showPageEditForm",
      '*actions': "showPageForm"
    },
  });
  var initialize = function(){
    appRouter = new AppRouter;
    appRouter.on("route:showPageForm", function(){
      console.log('hej');
    });
    appRouter.on("route:showPageEditForm", function(){
      console.log('ho');
    });
    var page_form = new ManagePages();
      Backbone.history.start();
    }
    return {
      initialize: initialize
    }
  });

So basically when the user goes to http://example.com/new_page it should log <code>hej</code> and when he goes to http://example.com/editpage it should log <code>ho</code>. I don’t know how to accomplish this or even if it is possible. Can anyone help me?

  • 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-14T12:12:59+00:00Added an answer on June 14, 2026 at 12:12 pm

    You could use Backbone’s support for HTML5 push-state, which uses the URL path by default (instead of the hash fragment). Just specify it as an option when calling history.start:

    Backbone.history.start({ pushState: true });
    

    (Note that if your application is located in a sub-path under the domain, then you can tell Backbone to use that as the root — Backbone.history.start({pushState: true, root: "/myapproot/"}) — although it looks like that’s not a concern in your case.)

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

Sidebar

Related Questions

I have struggled with this for a long time, and I did get a
This is a very lame question, but I have struggled with it far too
I have struggled a lot spent quiet a lot of time but unable to
have written this little class, which generates a UUID every time an object of
I know that this is quite subjective, but is it something that I have
I have struggled converting this SQL statement to LINQ to SQL VB.Net 9.0. I
Have struggled with this call for a while now but i can't get it
I have struggled with this since day 1. It probably doesn't help that I've
So I have been developing in Android for quite some time and I am
I have struggled with this issue for several weeks. I have Googled it and

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.