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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:38:38+00:00 2026-06-01T23:38:38+00:00

I am building a system that will pull 2 variables from the url (variable1.domain.com/variable2).

  • 0

I am building a system that will pull 2 variables from the url (variable1.domain.com/variable2).

I cannot find any documentation showing how to do anything with subdomains in backbone. Default_url is just passed as domain.com/api. I did find something called CORS (www.enable-cors.org) that enables cross domain calls, but it says nothing about dynamic domains.

Is something like this even possible with backbone? If not, does anyone know if ember.js or other backbone-like systems have this “feature”?

  • 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-01T23:38:40+00:00Added an answer on June 1, 2026 at 11:38 pm

    This is certainly possible but not within the scope of Backbone’s default behavior. Assuming that all your subdomains utilize the same router code, you could hack up a solution that might look like this:

    var Router = Backbone.Router.extend({
      routes: {
        '*variables': 'buildRoute'
      },
    
      subdomain: function() {
        // This is probably not the prettiest/best way to get the subdomain
        return window.location.hostname.split('.')[0];
      },
    
      buildRoute: function(variables) {
        // `variables` are all your hash variables
        // e.g., in the URL http://variable1.domain.com/#variable3=apples&variable4=oranges
        // `variables` here would be the string 'variable3=apples&variable4=oranges'
        // so you would have to parse that string into a JSON representation, but that's trivial
        // Once you have the JSON, you can do something like:
        myView.render(this.subdomain(), variablesJSON);
        // Your view's `render` function then has the subdomain and all the variables from the URL,
        // so it can use them appropriately.
      }
    });
    

    One important caveat with this approach: it works fine for users navigating to URLs themselves, but will quickly become wonky when your application needs to perform a navigate call to the Router. Backbone will navigate only to hash portion of the URL, so it will not include subdomain. You would probably have to spin up a custom navigation function that sets window.location before doing anything else.

    Obviously this is probably not something Backbone is well-suited for. I’m unsure if Ember or anything else has this functionality, but I would doubt it. Subdomains are meant to be distinct areas of your site, so you might not be using them correctly.

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

Sidebar

Related Questions

I am building a web application that will pull event logs from multiple servers
I'm building a system that will create a tournament based on a list of
I'm building a login system within my app that will be called several times.
I am building a training system in Asp.net coded in C# that will allow
I'm building an Outlook 2010 add-in that will tie into our ticketing system using
I am building a system that will use a commenting based ticket system. I
I'm building a system that updates its local database from other APIs frequently. I
I'm building a system that will send verses of scripture to subscribers over e-mail.
We are building a system that gets XML data from a database, uses XSLT
I will be building a system where a particular object will originate from a

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.