jsGET: Set and get variable passed in the page URL hash

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2011-02-12 (4 years ago) RSS 2.0 feedNot enough user ratingsTotal: 312 All time: 122 This week: 96Up
Version License JavaScript version Categories  
jsget 0.1GNU General Publi...2.0Browser
Description Author  

This object can be used to set and get variable passed in the page URL hash.

It can retrieve the current page URL and parse the value in front of the URL hash, if present.

The object can also set new variable values and add listener so given callback functions are called when the variables in the current page URL hash are changed eventually when links in the page are clicked or the user used the browser back or forward buttons.

Picture of Fabian Vogelsteller
Name: Fabian Vogelsteller <contact>
Classes: 1 package by
Country: Germany Germany
Age: 31
All time rank: 724 in Germany Germany
Week rank: 48 Up4 in Germany Germany Equal



Copyright (C) Fabian Vogelsteller [frozeman.de] 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 <http://www.gnu.org/licenses/>. _____________________________________________


Fabian Vogelsteller <http://frozeman.de>


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!

  Files folder image Files  
File Role Description
Plain text file jsGET.js Class the jsGET object
Accessible without login Plain text file demo.html Example the demo page
Accessible without login Plain text file README.md Doc. readme

 Version Control Unique User Downloads Download Rankings  
 0%Total:312All time:122
 This week:0This week:96Up