-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4everSession.js
More file actions
31 lines (30 loc) · 1.17 KB
/
4everSession.js
File metadata and controls
31 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function refreshSessionDam(url) {
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
var intervalo = 0;
var totalReset = 0;
var timeout = 10000;
function resetTimeout(timeout){
totalReset++;
window.clearInterval(intervalo)
timeout = (Math.floor((Math.random()*60000)+1) + 60000);
intervalo = window.setInterval(function(){ resetTimeout(timeout)}, timeout);
refreshSessionDam('__REEMPLAZAR URL ACAAAAAAAAAAA__'); //@todo: reemplazar URL
console.log("intervalo: " + intervalo + ", timeout: " + timeout/1000 + "segs, ejecutados: " + totalReset);
}
intervalo = window.setInterval(function(){ resetTimeout(timeout)}, timeout);
console.log("intervalo: " + intervalo + ", timeout: " + timeout/1000 + "segs, ejecutados: " + totalReset);