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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:37:53+00:00 2026-06-01T10:37:53+00:00

I have a html wrapper app loading all js, css and images from ipad

  • 0

I have a html wrapper app loading all js, css and images from ipad file storage. The UIWebView is therefore loaded with a different base href.

Loading of backbone data should go to server as normal. Is there a way to set base href in backbone – so backbone is realtive to server, not file storage? Maybe in a global way?

  • 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-01T10:37:54+00:00Added an answer on June 1, 2026 at 10:37 am

    One option is to override the url or urlRoot property of each Collection or Model type you want to “re-base” like:

    Article = Backbone.Model.extend({
      url: function() {
        return "http://myapiserver.com/articles/" + this.id;
        // Or slightly better, use some global for the base url and build from that
      }
    });
    

    If you have a lot of Model and Collection types and you want all of their urls to be re-based, you might be better served by overriding Backbone.sync (which is called by all of the model and collection CRUD operations) to override the url before it gets pumped into $.ajax(). You can do something like this:

    // We'll call the "standard" Backbone.sync to do the real work, so grab a
    // reference to it.
    var oldSync = Backbone.sync;
    
    Backbone.sync = function(method, model, options) {
        var url = _.isFunction(model.url) ? model.url() : model.url;
    
        if (url) {  // If no url, don't override, let Backbone.sync do its normal fail
            options = options || {};
            options.url = "http://myapiserver.com" + url;
        }
    
        // Let normal Backbone.sync do its thing
        return oldSync.call(this, method, model, options);
    }
    

    I haven’t tested that exact code, but I think it (or something close) should work.

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

Sidebar

Related Questions

I have html-file. I have to replace all text between this: [%anytext%]. As I
I have html and css as below - .title { display: block; background-color: red;
I have HTML + CSS text. I need some lib with simple function like
I'm trying to build my Flex/Java web app from within IntelliJ rather than have
I have a bunch of texts and images (taken from the content tag of
I have the following html: <div id=join-us-subheader-imgs> <div class=subheader-img-wrapper> <img src=/wp-content/themes/lib/join_us/join-us_1.png> <p class=img-quote>This is
Assume I have the following html: <html> <head> </head> <body> <div id=wrapper > <div
I have the following HTML: <div id=footer> <div class=wrapper clear> <!-- stuff --> </div>
I've got a Javascript file which is automatically generated from a legacy app which
I have following HTML code: <div id=wrapper> <div class=page id=first> Test<br/> Test<br/> Test<br/> Test<br/>

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.