This is a migrated thread and some comments may be shown as answers.

Unexpected Session Out. RadWindow Event attching

0 Answers 30 Views
Window
This is a migrated thread and some comments may be shown as answers.
Raman
Top achievements
Rank 1
Raman asked on 21 Feb 2014, 06:46 PM
The application is doing unknown timeout even if working on the application.We have done the manual alert & session out using JavaScript with the following code. We are using the RadWindow from telerik in the application. But this code is not able to attach the mousemove, keydown & click events from the radwindow popup.Even if we are working on the application we get an alert for timeout. Can anyone help with this problem? 

// Function to Open Any Generic Window Popup
function OpenRadWind(URL, HorzLength, VertLength, MoveToLeft, MoveToTop) {
RadWindow1 = new window.radopen(URL, "RadWindow");
RadWindow1.setUrl(RadWindow1.get_navigateUrl());
RadWindow1.set_visibleStatusbar(true);
RadWindow1._showContentDuringLoad = false;
RadWindow1.maximize();
//TimeOut Function
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'mousemove', resetTimer);
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'keydown', resetTimer);
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'click', resetTimer);
return false;
}function resetTimer() {
var idleSeconds = 10;
var idleTimer;
clearTimeout(idleTimer);
idleTimer = setTimeout(whenUserIdle, idleSeconds * 1000);
}//TimeOut Function
attachEvent(window, 'load', function () {
attachEvent(document.body, 'mousemove', resetTimer);
attachEvent(document.body, 'keydown', resetTimer);
attachEvent(document.body, 'click', resetTimer);
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'mousemove', resetTimer);
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'keydown', resetTimer);
attachEvent(RadWindow1.GetContentFrame().contentWindow, 'click', resetTimer);
resetTimer(); // Start the timer when the page loads
});function whenUserIdle() {
if (window.location.pathname.search("Login.aspx") == -1) {
alert("Your Current Session Is Over");
window.location = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname.split('/')[1] + "/Account/Login.aspx?logout=";
}
}function attachEvent(obj, evt, fnc, useCapture) {
if (obj.addEventListener) {
obj.addEventListener(evt, fnc, !!useCapture);
return true;
} else if (obj.attachEvent) {
return obj.attachEvent("on" + evt, fnc);
}
}

No answers yet. Maybe you can help?

Tags
Window
Asked by
Raman
Top achievements
Rank 1
Share this question
or