Make people stay on web page

by GOKILAVANI 2014-05-22 09:20:20


 A  mail message to the user how long they visited the particular website as well as opening a new window is provided by the javascript given below.
<head><script type="text/javascript">
var STS = 0;
var ETS = 0;
var TIMON = 0;
function getStime() {

// optional audio welcome 
// location = "welcome.au";

now = new Date();

STS = (now.getTime());

// optional.
// changes the window status bar at bottom of page return true must remain
// Only works if user allows JavaScript to change his/her status bar text

//window.status = "I hope you enjoy"; return true ;

}

function figure() {

// code to get seconds from logon to logoff

postnow = new Date();

ETS = (postnow.getTime());

TIMEON = ((ETS - STS) / 1000);

// if less than 60 seconds

if (TIMEON < 60) {

// open an alert box and plead with user

alert ( TIMEON + " seconds. Give it a chance!");

// Optional - open a new window to play an audio plea.

//window.open ("under.au","newwin","width=200, height=200");

}
else { 
alert (TIMEON + " seconds. Thanks for reading!");
}
return true; 
}
window.onload = getStime; 
window.onunload = figure;
</script>
<title></title>
</head>
681
like
0
dislike
0
mail
flag

You must LOGIN to add comments