[Racine des codes] [Page précédente]

RemoveParamURL

/Html JavaSript/URL/RemoveParamURL.js
function RemoveParamURL(URL, Param){
  // return the URL without its parameter Param
  var Turl = URL.split(/[?&]/);
  var Exp = new RegExp('^'+Param+'=.*');
  URL = Turl[0]+'?';
  for (var ind=1; ind<Turl.length; ind++) {
    if(!Turl[ind].match(Exp))
      URL += (URL[URL.length-1]=='?'?'':'&') + Turl[ind];
  }
  return URL;
}
[edit]