Session Timeout Notification - Flashing Tab in browser?

3 posts, 1 answers
  1. John Snyder
    John Snyder avatar
    43 posts
    Member since:
    Mar 2006

    Posted 12 Aug 2011 Link to this post

    I am trying to implement the Session Timeout functionality. 

    1) Is it possible to somehow get the browser window to flash/blink or something similar when the notification appears? If I have opened a PDF from my site and am reading that in its own tab, and the session timeout window appears on the previous tab, I want to be notified that it exists, otherwise the Timeout Window becomes a bit more pointless.  

    2) Also, your Session Timeout demo gets quite confusing when you say some of the code is there only for the demo but not needed otherwise, yet I can't seem to get mine to redirect me after the 2 minutes.  Do you have a quick sample that shows an alert after 10 seconds, and then after 5 seconds of being visible, (and no action taken...simulating a session timeout) it redirects to a new page? I'm not sure what I am doing wrong.  

    Here's the HTML code I have so far:
    <script language="javascript">
        function SessionTimeoutOnShowing(sender, args) {
        }
        function ContinueSession() {
            var notification = $find("rnSessionTimeout");
            notification.update();
            notification.hide();
        }
    </script>
     
        <telerik:RadNotification ID="rnSessionTimeout" runat="server" Position="Center" Width="300"
            Height="125" LoadContentOn="PageLoad" AutoCloseDelay="10000" ShowInterval="15000"
            Title="Session Expiration" Value="~/" TitleIcon="Warning" OnClientShowing="SessionTimeoutOnShowing"
            ContentIcon="Warning" Skin="Default" EnableRoundedCorners="true">
            <ContentTemplate>
                    Your session is about to expire. Do you wish to continue using this site?<br />
                    <telerik:RadButton Skin="Default" ID="continueSession" runat="server" Text="Continue Your Session" Style="margin-top: 10px;" OnClientClick="ContinueSession(); return false;" />
            </ContentTemplate>
        </telerik:RadNotification>
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 16 Aug 2011 Link to this post

    Hello Dustin,

    Making a browser blink is generally not possible via JavaScript, as it would be a security risk - exposing the client machine to the JavaScript. After some research in the net I believe that the most common way of providing such a notification is changing the page's title with a setInterval function. I believe the following links will help you get started on your implementation:
    http://forums.mozillazine.org/viewtopic.php?f=25&t=404146
    http://stackoverflow.com/questions/4371016/make-browser-tab-flash-a-notification
    http://www.google.com/search?q=make+browser+tab+flash
    http://www.google.com/search?q=make+browser+tab+blink

      As for the demo - I am sorry that you feel this way. The UI is really a bit long, yet most of it is for the demonstration. For your convenience I created and attached a simple page that will display a notification and if the user takes no action he/she will be redirected. The only issue here is that this will have to be hardcoded for such small time intervals, as the Session on the server is an integer in minutes and the ShowInterval property of the RadNotification is also an integer, in milliseconds. Please note my comments in the code.


    Regards,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Snyder
    John Snyder avatar
    43 posts
    Member since:
    Mar 2006

    Posted 16 Aug 2011 Link to this post

    That worked great. Thanks for the clean example.  Was very easy to read (much cleaner than the demo in my opinion).

    Note that I didn't truly need the timeout times that short I was just trying to do something quick.  I am using full minutes typically.
Back to Top