dc_jt Posted June 26, 2009 Share Posted June 26, 2009 Hi I am using the code below to refresh a page using javascript and ajax so that a user is never kicked out however I have had one user say they were kicked out. Is there any reason why their session may have expired? Could it be anything to do with their browser such as they dont have javascript enabled maybe? function Ajax() { this.toString = function() { return "Ajax"; } this.makeRequest = function(_method, _url) { this.request = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP"); this.request.open(_method, _url, true); this.request.send(_url); } this.checkReadyState = function(_id, _1, _2, _3) { switch (this.request.readyState) { case 1: if (_id != null) document.getElementById(_id).innerHTML = _1; break; case 2: if (_id != null) document.getElementById(_id).innerHTML = _2; break; case 3: if (_id != null) document.getElementById(_id).innerHTML = _3; break; case 4: return this.request.status; } } } var oAjax = new Ajax(); var limit = 0; function ajaxRefresh() { if (limit==1) { //make background request oAjax.makeRequest('GET', '/sessionrefresh.php'); limit = iMinutes * 60 + iSeconds; } else { limit--; } setTimeout("ajaxRefresh()",1000) } function beginAjaxRefresh() { limit = iMinutes * 60 + iSeconds; setTimeout("ajaxRefresh()",1000) } var iMinutes = 5; var iSeconds = 0; beginAjaxRefresh(); Quote Link to comment Share on other sites More sharing options...
xenophobia Posted June 27, 2009 Share Posted June 27, 2009 what code you've written on your sessionrefresh.php? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.