I have a really long (~70,000 characters) string that I want to insert into URL. I need to implement back-forward in a browser, so when the URL changes my app will react and change it's state.
This is the function I use to generate the hash code from the string:
String.prototype.hashCode = function () { var hash = 0, i, char; if (this.length == 0) return hash; var l = this.length; for (i = 0; i < l; i++) { char = this.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash |= 0; // Convert to 32bit integer } return hash; };
But how can I get my string back from it's hash?
Edits: Is there any other way to compress such a long URL?