diff --git a/backbone.js b/backbone.js index ea8095f7..9873110f 100644 --- a/backbone.js +++ b/backbone.js @@ -693,7 +693,7 @@ // history and to then load the route at that fragment. setLocation : function(fragment) { Backbone.history.saveLocation(fragment); - Backbone.history.loadUrl(); + Backbone.history.loadUrl(fragment); }, // Bind all defined routes to `Backbone.history`. We have to reverse the @@ -753,7 +753,8 @@ // twenty times a second. interval: 50, - // Get the cross-browser normalized URL fragment. + // Get the cross-browser normalized URL fragment, either from the URL, + // the hash, or the override. getFragment : function(fragment, forcePushState) { if (!fragment) { if (this._hasPushState || forcePushState) { @@ -771,17 +772,23 @@ // Start the hash change handling, returning `true` if the current URL matches // an existing route, and `false` otherwise. start : function(options) { + + // Figure out the initial configuration. Do we need an iframe? + // Is pushState desired ... is it available? if (historyStarted) throw new Error("Backbone.history has already been started"); this.options = _.extend({}, {root: '/'}, this.options, options); this._wantsPushState = !!this.options.pushState; this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState); var fragment = this.getFragment(); - var docMode = document.documentMode; - var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); + var docMode = document.documentMode; + var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); if (oldIE) { this.iframe = $('