zoukankan      html  css  js  c++  java
  • jquery记录页面访问停留时间

     function visit_timing()
        {
            var start;
            var end;
            var duration = 0;
            start = new Date();
                $(window).bind('beforeunload', function(e) {
                    end = new Date();//用户退出时间
                    duration = end.getTime() - start.getTime();
                    duration = duration/1000;//取的是秒
                    $.ajax({
                        type: 'POST',
                        async: false,//这块至关重要,用$post默认是true
                        url: 'url',
                        data: {a:1.vid,b:duration}
                    });
                });
        }

  • 相关阅读:
    Redis详解
    Linux常用命令
    sqlserver 游标写法
    Flask总结
    HTTPS协议
    Django REST framework 简介
    Cookie和session
    利用rest-framework编写逻辑关系
    vuex
    jQuery和Bootstrap的优点
  • 原文地址:https://www.cnblogs.com/fgtt/p/6733668.html
Copyright © 2011-2022 走看看