Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var url = window.location.href;
- if (url.indexOf('?') > -1){
- url += '¶m=1'
- }else{
- url += '?param=1'
- }
- window.location.href = url;
- window.location.search += '¶m=42';
- location.href = location.href + "¶meter=" + value;
- https://stackoverflow.com/?¶m=1¶m=1¶m=1¶m=1¶m=1¶m=1¶m=1¶m=1¶m=1
- function URL_add_parameter(url, param, value){
- var hash = {};
- var parser = document.createElement('a');
- parser.href = url;
- var parameters = parser.search.split(/?|&/);
- for(var i=0; i < parameters.length; i++) {
- if(!parameters[i])
- continue;
- var ary = parameters[i].split('=');
- hash[ary[0]] = ary[1];
- }
- hash[param] = value;
- var list = [];
- Object.keys(hash).forEach(function (key) {
- list.push(key + '=' + hash[key]);
- });
- parser.search = '?' + list.join('&');
- return parser.href;
- }
- location.href = URL_add_parameter(location.href, 'param', 'value');
- function gotoItem( item ){
- var url = window.location.href;
- var separator = (url.indexOf('?') > -1) ? "&" : "?";
- var qs = "item=" + encodeURIComponent(item);
- window.location.href = url + separator + qs;
- }
- function gotoItem( item ){
- var url = window.location.href;
- url += (url.indexOf('?') > -1)?"&":"?" + "item=" + encodeURIComponent(item);
- window.location.href = url;
- }
- location.href = location.href + "¶meter=" + value;
Add Comment
Please, Sign In to add comment