今天测试代码,安卓的qq浏览器9.7版本和 安卓的360安全浏览器出现一个bug
a.html 页面加下边代码
——————————————————————————<a  href='b.html'  id='aaa'></a> 
<script>
setTimeout(function(){document.getElementById("aaa").click();}, 1200);
</script>如果打开a.html 并且手指主动点击(按)一下 a.html网页的任意位置,然后代码跳转到 b.html,按返回的时候会返回到 a.html如果打开a.html 什么都不管,代码自动跳转到 b.html,按返回的时候会直接退出有没有什么代码,让代码主动模拟手指按屏幕的操作,从而实现代码能返回到 a.html

解决方案 »

  1.   

    模拟触发click可以看看https://www.jb51.net/article/164037.htm不过模拟的终归只是模拟的,有些操作必须是用户真实点击时浏览器才允许执行。比如window.open()
      

  2.   


    var onlongtouch; 
    var timer;
    var touchduration = 500; touchstart() {
        timer = setTimeout(onlongtouch, touchduration); 
    }touchend() {
        if (timer)
            clearTimeout(timer);
    }onlongtouch = function() { //do something };