From: Anders S. Mortensen Date: Thu, 28 Dec 2006 11:02:48 +0000 (+0000) Subject: Added rudimentary back-button functionality. X-Git-Tag: before.append.child~70 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=099b11ff3a8af3c87c02bd211e2c233ae2e6e491;p=pazpar2-moved-to-github.git Added rudimentary back-button functionality. --- diff --git a/www/test1/index.html b/www/test1/index.html index 1635922..4f786bd 100644 --- a/www/test1/index.html +++ b/www/test1/index.html @@ -306,10 +306,61 @@ function start_search() xsearch.send(null); document.getElementById("termlist").innerHTML = ''; document.getElementById("body").innerHTML = ''; + update_history(); shown = 0; startrec = 0; } + +function session_encode () +{ + var session_cells = Array('query'); + var i; + var session = ''; + + for (i = 0; i < session_cells.length; i++) + { + var name = session_cells[i]; + var value = escape(document.getElementById(name).value); + session += '&' + name + '=' + value; + } + + return session; +} + + +function session_decode (session) +{ + +} + + +function session_read () +{ + var ses = document.location.href; + return ses.replace(/.*#/, ''); +} + + +function session_store (new_value) +{ + var location = document.location.href; + + location = location.replace(/#.*$/, ''); + location += '#' + new_value; + document.location.href = location; +} + + +function update_history () { + var session = session_encode(); + session_store(session); +} + + + + +