cross-browser history management
Handles cross-browser history management, based on either pushState and real URLs, or onhashchange and URL fragments. If the browser supports neither.
Update the hash location, either replacing the current entry, or adding a new one to the browser history.
Checks the current URL to see if it has changed, and if it has,
loadUrl, normalizing across the hidden iframe.
Unicode characters in
location.pathname are percent encoded so they're
decoded for comparison.
%25 should not be decoded since it may be part
of an encoded parameter.
Returns string decoded fragment
Get the cross-browser normalized URL fragment from the path or hash.
Returns string normalized url fragment
Gets the true hash value. Cannot use location.hash dir in Firefox where location.hash will always be decoded.
windowobject the global window or History instance
Get the pathname and search params, without the root.
Returns string pathname and search params
In IE6, the hash fragment and search params are incorrect if the
Attempt to load the current URL fragment. If a route succeeds with a match, fires 'change' event.
Does the pathname match the root?
Save a fragment into the hash history, or replace the URL state if the 'replace' option is passed. You are responsible for properly URL-encoding the fragment in advance.
The options object can contain
trigger: true if you wish to have the
route callback be fired (not usually desirable), or
replace: true, if
you wish to modify the current URL without adding an entry to the history.
Start the hash change handling, returning
true if the current URL
matches an existing route, and
Disable Backbone.history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
conglomerate-history is released under the terms of the BSD-3-Clause license.
This software includes or is derivative of works distributed under the licenses listed below. Please refer to the specific files and/or packages for more detailed information about the authors, copyright notices, and licenses.
- Backbone is released under the terms of the MIT license.
Thanks to Jeremy Ashkenas and the rest of the Backbone.js authors.