Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Javascript helper object to save/fetch JSON to URL hash

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README
Octocat-spinner-32 hash_helper.js
README
Helper to handle saving/fetching JSON to URL hash.

Useful for presisting user settings in the URL's hash fragment.
When the user refreshes the page, you can fetch those settings directly from the URL.

Example:
Hash.set({my_id:1, your_id:2, your_name:"John"}); // http://www.example.com#{my_id:1,your_id:2,your_name:John}
Hash.get('my_id'); // Returns 1

Notice that the JSON in the URL has no double quotes. This is because they
get stripped when transmitted in emails. If you put spaces in a string, they
will gracefully be escaped in the URL.

Author: Martin Drapeau
Copyright 2009-2012 Planbox Inc.
Note: Requires json2.js (https://github.com/douglascrockford/JSON-js)
Something went wrong with that request. Please try again.