I count the time the user takes to solve my quiz using Javascript but I want the same time displayed on another page

42 views Asked by At

How can I display the same time on another page without using cookies because its just a local website and database isn't such a good idea? Is there something else I can do?

1

There are 1 answers

2
3pic On

local storage should be very ok. http://www.alsacreations.com/xmedia/doc/full/web-storage.jpg

example :

    //page A
var counted_time=[your algorithm result];
    localStorage.setItem("mytime_hey", counted_time);

    //page B
        var mytime = localStorage.mytime_hey; 
    $("#mydiv").html("your time is"+mytime+" !");

//// if your question is : how to count ? that s another matter. make a difference between 2 date : How Many Seconds Between Two Dates?