Page 1 of 1

Re: getting the page URL

Posted: Wed Apr 23, 2014 10:38 pm
by eddy
Hi,
I updated your last function:

Code: Select all

Procedure.s getURLparam(ParamName.s="")
  If ParamName    
    !var results = new RegExp('[\\?&]' + v_ParamName + '=([^&#]*)').exec(window.location.search);
    !return (results==null) ? null : decodeURIComponent(results[1]) || 0;
  Else 
    !return window.location.search;
  EndIf 
EndProcedure
if the URL is 'http://www.somesite.com/path/subpath/pa ... e&arg3=200'
getURLparam("arg3") will return "200"
getURLparam("arg2") will return "true"
getURLparam("arg1") will return "HELLO WORLD"
getURLparam() will return ?arg1=HELLO%20WORLD&arg2=true&arg3=200