removeurlparameter javascript

Solutions on MaxInterview for removeurlparameter javascript by the best coders in the world

showing results for - "removeurlparameter javascript"
Leigh
25 Feb 2016
1function removeParams(sParam)
2{
3            var url = window.location.href.split('?')[0]+'?';
4            var sPageURL = decodeURIComponent(window.location.search.substring(1)),
5                sURLVariables = sPageURL.split('&'),
6                sParameterName,
7                i;
8         
9            for (i = 0; i < sURLVariables.length; i++) {
10                sParameterName = sURLVariables[i].split('=');
11                if (sParameterName[0] != sParam) {
12                    url = url + sParameterName[0] + '=' + sParameterName[1] + '&'
13                }
14            }
15            return url.substring(0,url.length-1);
16}
17
18window.location = removeParams(parameter);