Backbone URI Storage is a Backbone.js Sync Adaptor designed for saving an application state model in the URI
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Backbone URI Storage

Backbone URI Storage is a sync adaptor for Backbone.js, inspired by Backbone.localStorage.

As the name implies, it uses the URI for data storage engine, and therefore is ideal for implementing a model representing an application state or a state machine. The adapter saves the data in a JSON string, allowing the model to restore primitive variable types later.

An improved version of the adapter takes advantage of History.js for pushState support and cleaner URIs.

  • A working demo of the History.js driven adaptor can be found here.
  • Some background and what problem lead me to write this adaptor can be found here.


var State = Backbone.Model.extend({
  sync: uriSync

var state = new State({id: 'state'});
// optional - bind to changes made on the URI and auto update the model
$(window).on("hashchange", function(){
  state.clear({silent: true});