Redirect traffic based on "?ref=XXX" at end o URL
This question already has an answer here:
use this function with the parameters matters
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[[]]/g, "$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/+/g, " "));
}
Code Source: first answer here How can I get query string values in JavaScript?
and than create your link to redirect, and finally redirect usingo window.location = 'tour-url';
链接地址: http://www.djcxy.com/p/34740.html