0
How to track the time of a user, spent on a web page?
I am creating a quiz. The user can access the quiz for unlimited times. I want to get the time duration of the each user and the number of attempts to show it to the user.
3 Answers
+ 1
Make a start button which gets the current time in milliseconds from 1970 (new Date().getTime()). Then an end button which does it again. Take away the first time from second and turn it into seconds (/1000).
+ 1
It's obviously simplified but should give you the general idea: https://code.sololearn.com/WWrf0POBosRN/?ref=app
0
TurtleShell would you be able to give me a simple code if you don't mind.