Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<script language="javascript">
var oInterval;
var MAX_WITHOUT_ACTIVITY=10000; //number of milliseconds without activity before reload.
function InitPage() {
var oHid_h = document.getElementById("hid_lastActivity_h");
var oHid_mn = document.getElementById("hid_lastActivity_mn");
var oHid_s = document.getElementById("hid_lastActivity_s");
var oDate=new Date();
oHid_h.value = oDate.getHours();
oHid_mn.value = oDate.getMinutes();
oHid_s.value = oDate.getSeconds();
oInterval = window.setInterval("VerifyActivity()", 10000); // check every 10 seconds
}
function Activity() {
var oHid_h = document.getElementById("hid_lastActivity_h");
var oHid_mn = document.getElementById("hid_lastActivity_mn");
var oHid_s = document.getElementById("hid_lastActivity_s");
var oDate=new Date();
oHid_h.value = oDate.getHours();
oHid_mn.value = oDate.getMinutes();
oHid_s.value = oDate.getSeconds();
}
function VerifyActivity() {
var oHid_h = document.getElementById("hid_lastActivity_h");
var oHid_mn = document.getElementById("hid_lastActivity_mn");
var oHid_s = document.getElementById("hid_lastActivity_s");
var oDate=new Date(); // current date and time
var oLastActDate=new Date(oDate.getYear(), oDate.getMonth(), oDate.getDate(), oHid_h.value, oHid_mn.value, oHid_s.value); // last activity date and time.
if ((oDate.valueOf() - oLastActDate.valueOf()) > MAX_WITHOUT_ACTIVITY)
Alert("Are you sleeping ? You didn't do anything during the past " + (MAX_WITHOUT_ACTIVITY /1000) + " seconds.");
}
</script>
</head>
<body onload="InitPage();" onmousemove="Activity();" onkeydown="Activity();">
<input id="hid_lastActivity_h" type="hidden" value=""/>
<input id="hid_lastActivity_mn" type="hidden" value=""/>
<input id="hid_lastActivity_s" type="hidden" value=""/>
</body>
</html>