javascript detect time on page

Solutions on MaxInterview for javascript detect time on page by the best coders in the world

showing results for - "javascript detect time on page"
Granger
27 Oct 2020
1$(document).ready(function() {
2  var start = new Date();
3
4  $(window).unload(function() {
5      var end = new Date();
6      $.ajax({ 
7        url: "log.php",
8        data: {'timeSpent': end - start},
9        async: false
10      })
11   });
12});
13