console.log("testStart") function getParameterByName(name, url = window.location.href) { name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); console.log("test1"); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } function containsSpecialChars(str) { const specialChars = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/; return specialChars.test(str); } window.onload = function() { var anchors = document.getElementsByTagName("a"); let code = getParameterByName('code'); if(!code || containsSpecialChars(code)) return; for (var i = 0; i < anchors.length; i++) { if(anchors[i].href.indexOf("quikformsapp") >= 0) anchors[i].href += "signup?code=" + code; else anchors[i].href += anchors[i].href.indexOf('?') != -1 ? "&code=" + code : "?code=" + code; } }