美文网首页
js 监听手机返回键

js 监听手机返回键

作者: 昱弟丶 | 来源:发表于2019-05-31 14:58 被阅读0次
    <script>
        $(function(){
            pushHistory();
            window.addEventListener("popstate", function(e) {
                window.location = 'http://www.baidu.com'
            }, false);
            function pushHistory() {
                var state = {
                    title: "title",
                    url: "#"
                };
                window.history.pushState(state, "title", "#");
            }
        });
    </script>
    

    相关文章

      网友评论

          本文标题:js 监听手机返回键

          本文链接:https://www.haomeiwen.com/subject/dlzwtctx.html