// requires env var Utils = {}; Utils.getParameterByName = function(name, dft) { url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return dft; if (!results[2]) return ""; return decodeURIComponent(results[2].replace(/\+/g, " ")); }; Utils.redirect = function(path) { path = path + ((env.TEST && !env.FORCE_PROD) ? location.search : ""); // mantain query string in tests location.href = path; };