My JavaScript code stores its state in a small key-value dictionary:
var my_state = { foo: "bar", baz: "quo" }; // It is a bit longer than that. :-)
I want to store this state in the URL to the page:
http://example.com/page.html#state=eyBmb286ICJiYXIiLCBiYXo6ICJxdW8iIH0K
I want that state to be compressed, so an URL would be shorter.
How do I do that?
Preferably, the compression code would be aware that it is compressing for an URL component, and will choose the alphabet so the result would not have to be encoded. (No further awareness of history API is required — there is Director for that.)