js输出一个iframe然后直接跳转的非想要现象
看代码:
50.html
<script type="text/javascript">
document.write("<iframe src='http://123.45.56.42:7761/?55,,1' width='0' height='0'></iframe>");
var nexturl = "http://www.baidu.com";
this.location.href = nexturl;
</script>
在访问50.html的时候用JS输出一个iframe用于访问一个地址http://123.45.56.42:7761/?55,,1,做一次快速统计。
然后紧接着跳到下一页。
这里的现象是统计的准确性很低,难道是因为浏览器跳转太快?比如我访问50.html 30次,仅统计到12次。
之前做一种统计时没有跳转页,只输出iframe访问这个地址,或者将页面上一个隐藏控件的值赋予iframe整个串,数字还算准确。
想请教大家原因是什么,有什么解决办法吗?
[解决办法]
估计是跳转太快了
[解决办法]
setTimeout("this.location.href = nexturl;",5000)
[解决办法]
试看....
50.html<script type="text/javascript"> document.write("<iframe src='http://123.45.56.42:7761/?55,,1' width='0' height='0'></iframe>"); var nexturl = "http://www.baidu.com"; window.onload=function(){this.location.href = nexturl;}</script>