0

I've used code that store commands (in jQuery Terminal) that need to be executed as JSON array in hash. with code like this:

function exec_hash() {
    if (location.hash) {
        var commands;
        try {
            commands = $.parseJSON(location.hash.replace(/^#/, ''));
            $.each(commands, function(i, command) {
                try {
                    terminal.exec(command);
                } catch(e) {
                    var cmd = $.terminal.escape_brackets(command);
                    var msg = "Error while exec with command " + cmd;
                    terminal.error(msg).error(e.stack);
                }
            });
        } catch (e) {
            //invalid json - ignore
        }
    }
}

And i had this idea to store entire terminal session in hash, so my question is how long url hash can be?

Huangism
  • 16,278
  • 7
  • 48
  • 74
jcubic
  • 61,973
  • 54
  • 229
  • 402
  • 1
    IE8 and IE9 have a max length for the ENTIRE url + query string + hash to be 2083 characters, including protocol. – scragar May 28 '14 at 14:45
  • 1
    if you control the clients you can do it with firefox, chrome, safari, opera. They have no practical limit. – Daniel Moses May 28 '14 at 14:53
  • 1
    URL and Hash are NOT the same. So this question shouldn't have been closed with that duplicate pointed to. – nl-x Apr 24 '15 at 14:26

0 Answers0