Session Timeout in Modal Window

3 posts, 0 answers
  1. ajmal
    ajmal avatar
    57 posts
    Member since:
    Oct 2006

    Posted 30 Dec 2010 Link to this post

    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. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 30 Dec 2010 Link to this post

    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.

  3. Amanda
    Amanda avatar
    25 posts
    Member since:
    Aug 2012

    Posted 25 Feb in reply to Cori Link to this post

    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;
    }

Back to Top