Some time ago I saw a website that encoded game replay data into unicode characters so that you could copy-and-paste the address to share it with friends. I basically want to do the same thing -- I've got some data in a JavaScript object and I want to put it into the address bar.
I know I can use jQuery.param or something like that, but I want a much more compact format.
Turns out this is a little tricky to Google. Most search results turn up URL shorteners, which is distinctly different. I am not trying to store a short URL in my database for later lookup. All the data should be in the URL itself.
What encoding can I use for this? A link or description of the algorithm is fine, but impementations for Node/JavaScript would be even better.
I only need to support the latest version of Chrome stable, so I don't care if older browsers can't handle the unicode. I think I'll put the data in the fragment portion (after #
) so I only need to support whatever encoding rules apply to that piece. I think just about anything is allowed, no?
JSON.stringify
? msgpack? – Droughty