HTML代码:
<iframe id="ARframe" frameborder="0" style="display:none" width="0" height="0" SCROLLING="NO" border="0" ></iframe>
JS代码:
jQuery().ready(function() {
if (location.href.indexOf("?") < 0) {
$("#ARframe",parent.document.body).attr("src","www.baidu.com")};
});
说明:
在页面中放一个隐藏的iframe,地址指向一个第三方访问数量统计页面地址;
当用户访问时第三方统计,假如网址为www.xxx.com,当用户第一次访问这个网址是第三方检测网站记录一条数据,提交表格,页面刷新,地址为www.xxx.com?t=success,这时候第三方不会记录数据,通过设置location.href.indexOf("?") < 0 来区分第三方监测网址在何时记录数据;
提交表格弹出提交成功对话框,然后刷新页面的JS代码:
<script type="text/Javascript">
Request = {
QueryString: function(item) {
var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)", "i"));
return svalue ? svalue[1] : svalue;
}
}
function isSuccess() {
if (Request.QueryString("t") == "Success") {
alert("完成提交,谢谢参与!");
}
}
isSuccess();
</script>