js通过获取地址栏参数跳转页面

    技术2024-06-17  70

    对于外链,如果直接用 <a href="http://www.***.net">外链</a> 就会暴露自己的地址,如果不想让对方知道确切来路,下面是一个方法。

    网上找来的一段js

    文件:gourl.html

    <script type="text/javascript">Request = { QueryString : function(item){  var svalue = location.search.match(new RegExp("[/?/&]" + item + "=([^/&]*)(/&?)","i"));  return svalue ? svalue[1] : svalue; }}window.location=Request.QueryString("refer");alert(Request.QueryString('refer'));</script>

    在其他页面调用:<a href="gourl.html?refer=http://www.***.net">外链</a>

    用处:在对方的来路统计中,来路都是显示 gourl.html。

    最新回复(0)