Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript detect time on page

$(document).ready(function() {
  var start = new Date();

  $(window).unload(function() {
      var end = new Date();
      $.ajax({ 
        url: "log.php",
        data: {'timeSpent': end - start},
        async: false
      })
   });
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #detect #time #page
ADD COMMENT
Topic
Name
1+2 =