User:Animum/urlparameters.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
var UrlParameters = new Array (); readparams(); function readparams() { var asReadInUrlParameters; var asReadInUrlParameter; // Get URL parameters asReadInUrlParameters = location.search.substring(1, location.search.length).split("&"); for (i = 0; i < asReadInUrlParameters.length; i++) { asReadInUrlParameter = asReadInUrlParameters[i].split("="); UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]); } } /* function UrlParameters(params) { if(location.href.indexOf(params + "=") != -1) { var parm = location.href.substring(location.href.indexOf(params) + params.length++).split("=")[1]; return decodeURIComponent((parm.indexOf("&") != -1 ? parm.split("&")[0] : parm)); } else { return undefined; } } */ // Copied from [[User:DerHexer]] with extreme pride