clear ( local storage , session storage ) after countdown timer is finished?
<p>i have this code for countdown timer which is stored in session storage and it's working just fine but i need to add more functionality like </p>

<ul>
<li>if the user leaves the site before countdown timer is finshed clear<br>
the local session</li>
<li>clear local session when the countdown timer is    finshed</li>
</ul>

<p>index page :- </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang=""&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Untitled Document&lt;/title&gt;
    &lt;meta name="Author" content=""/&gt;
    &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="myform"&gt;&lt;/div&gt;
&lt;b&gt;&lt;p&gt;this is the index page&lt;/p&gt;&lt;/b&gt;
    &lt;form id="" name="myform" action="submit.html" method="post"&gt;

    &lt;/form&gt;
&lt;script src="timer.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>submit page :- </p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;title&gt;New Web Project&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;

            &lt;h1&gt;submit is working&lt;/h1&gt;



    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>timer.js</p>

<pre><code>if(sessionStorage.getItem("total_seconds")){
    var total_seconds = sessionStorage.getItem("total_seconds");
} else {
    var total_seconds = 60*1;
}
var minutes = parseInt(total_seconds/60);
var seconds = parseInt(total_seconds%60);
function countDownTimer(){
    if(seconds &lt; 10){
        seconds= "0"+ seconds ;
    }if(minutes &lt; 10){
        minutes= "0"+ minutes ;
    }

    document.getElementById("myform").innerHTML = "الزمن المتبقى "+seconds+" : "+minutes;
    if(total_seconds &lt;= 0){
        setTimeout("document.myform.submit()",1);

    } else {
        total_seconds = total_seconds -1 ;
        minutes = parseInt(total_seconds/60);
        seconds = parseInt(total_seconds%60);
        sessionStorage.setItem("total_seconds",total_seconds)
        setTimeout("countDownTimer()",1000);
    }
}
setTimeout("countDownTimer()",1000);
</code></pre>