I currently have this code snippet in a CGI script:
document.onkeydown = function(e) {
switch (e.keyCode) {
case 37:
document.location = "?direction=West";
break;
case 38:
document.location = "?direction=North";
break;
case 39:
document.location = "?direction=East";
break;
case 40:
document.location = "?direction=South";
break;
}
};
That will update the QUERY_STRING
and then reload the page.
Can this be done without constantly reloading after every key stroke?
JSON? jQuery?
I've tried fiddling with url.replace()
and history.pushState()
.. no luck..