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

Session Timeout in Modal Window

2 Answers 373 Views
Window
This is a migrated thread and some comments may be shown as answers.
ajmal
Top achievements
Rank 1
ajmal asked on 30 Dec 2010, 11:21 AM

Hi ,

I have one telerik modal popup window in which I am loading some event, after session timeout occurs, page in the modal pop window redirects to login page.

What I want achieve is, On session Expiration modal window should disappear and parent page should be redirected to login page.

Any views on this.... attached is the snap?

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 30 Dec 2010, 02:19 PM
Hello Ajmal,

I think the simplest approach would be to add a script to the login page that checks if it's contained inside of a RadWindow and have it close the RadWindow and redirect the parent page.

Sys.Application.add_load(RedirectIfInRadWindow); 
    
function RedirectIfInRadWindow(){ 
    var rWnd = GetRadWindow(); 
        
    if (rWnd != null) { 
        // redirect parent page to current url 
        rWnd.BrowserWindow.location = window.location; 
        // close RadWindow 
        rWnd.close(); 
    
  
    Sys.Application.remove_load(RedirectIfInRadWindow);
}

You can find the GetRadWindow method on Telerik's RadWindow demos.

I hope that helps.
0
Amanda
Top achievements
Rank 1
Iron
answered on 25 Feb 2014, 07:09 PM
Lots can change in 4 years, including demos with 'GetRadWindow' - I went through the demos and couldn't find the referenced bit of code (which is sad, I could have really used it in my project...).

However!  The Google never forgets, so for future reference for fellow coders, here's the  entire code snippet.  I had to change the Sys.Application.add_load to window.onload, but other than that, everything worked like a gem for me!

window.onload = RedirectIfInRadWindow();
 
function RedirectIfInRadWindow() {
    var rWnd = GetRadWindow();
 
    if (rWnd != null) {
        // redirect parent page to current url
        rWnd.BrowserWindow.location = window.location;
        // close RadWindow
        rWnd.close();
    }
    Sys.Application.remove_load(RedirectIfInRadWindow);
}
 
function GetRadWindow() {
    var oWindow = null;
 
    if (window.radWindow) {
        oWindow = window.radWindow;
    }
    else if (window.frameElement.radWindow) {
        oWindow = window.frameElement.radWindow;
    }
    return oWindow;
}
Tags
Window
Asked by
ajmal
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Amanda
Top achievements
Rank 1
Iron
Share this question
or