Recommend this page to a friend!
  Classes of Fabian Vogelsteller  >  jsGET  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: readme
Class: jsGET
Set and get variable passed in the page URL hash
Author: By
Last change:
Date: 10 years ago
Size: 3,458 bytes


Class file image Download


Copyright (C) Fabian Vogelsteller [] published under the GNU General Public License version 3

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not,see <>. _____________________________________________


Fabian Vogelsteller <>


jsGET is a http GET-Variables clone for javascript, using the hash part of the URL (index.html#...). You can set and get variables, and run a listener to hash changes, e.g. when the the history back button get pressed. This allows you to create a usable history navigation in your ajay application. It should work with all a-grade browsers.




Just include the jsGET.js in your website/webapplication and use the jsGET object with it's methods to set, get, remove history hash variables. See the demo.html for examples.


  • vars: (object) the hash variables object loaded by get(), set(), remove(), or clear() or load().
  • vars.current: (object) the current variables.
  • vars.old: (object) the old variables, before they where changed with get(), set(), remove(), or clear(),load() or the browser history back button.
  • vars.changed: (object) the variabels which have changed since the last call of get(), set(), remove(), or clear(), load() or the browser history back button.


  • load(): loads the current hash variables into an JSON object.
  • clear(): clears the hash part of the URL.
  • get(get): (string) try to get a hash variable with the given name.
  • set(set): (string,number,object) sets the given parameters to the hash variales. If its a string it should have the following format: "key=value".
  • remove(remove): (string,array) the variable name(s) which should be removed from the hash variables
  • addListener(listener,callAlways,bind): (listener: function, callAlways: boolean, bind: object instance) creates a listener which calls the given function, when a hash change appears. The called function will get the vars property (vars.current,vars.old,vars.changed) and the "bind" as "this", when specified. The return of the addListener() method is a setInterval ID and must be passed to the removeListener() method, to stop the listening. When callAlways is FALSE, it only calls when the browser history buttons are pressed and not when get(), set(), remove() or clear() is called.
  • removeListener(listenerID): (the setInterval Id get from a addListener() method) removes a listener set with the addListener() method.


Everytime you call set(), remove() or clear() a new hash string will be set, that means you also create a new history step in the browser history!