<script type="text/javascript">
var time;
window.onload =
function() {
// Initialize
"time" variable to "0".
time = 0;
}
window.setInterval(calcTime, 1000);
function calcTime() {
// calculate
user-stay time
time += 1;
}
// notify a handler the
user-stay time as a query string before the page is unloaded.
window.onbeforeunload = function() {
var oRequest = new
XMLHttpRequest();
oRequest.open("get", "/handlers/HandlerTest.ashx?"+time,
false);
oRequest.send(null);
}
No comments:
Post a Comment