js获取referrer中的参数
var _typeForm = null; $(document).ready(function () { var curUrl = document.location.href;//当前url if (/MSIE (\d+\.\d+);/.test(navigator.userAgent) || /MSIE(\d+\.\d+);/.test(navigator.userAgent)) {//IE情况下 var referLink = document.createElement('a'); referLink.href = curUrl; document.body.appendChild(referLink); //referLink.click(); } else { //location.href = curUrl; } //获取Referer从而获得typeForm var Referer = document.referrer; _typeForm = GetQueryString("typeForm", Referer); console.log(_typeForm); }) //获取Referer参数的方法 function GetQueryString(name, Referer) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = Referer.match(reg); if (r != null) return unescape(r[2]); return null; }