Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
Hai Friends,
 
i called one javascript inbuilt function setTimeout('SessionWarning()', 2000).This function singout ma application after 2000 milleseconds.This function working fine in Firefox but not good in Chrome..my complete code shown in the following
 
<script language="javascript" type="text/javascript" charset="utf-8">
 

      var authorized = "<%= HttpContext.Current.User.Identity.IsAuthenticated.ToString().ToLower() %>";
      if (getAbsolutePath().toLowerCase() == 'sessionexpired.aspx') {
          authorized = "false";
          //alert(authorized);
      }
      if (authorized == "true") {
          var sessionTimeoutWarning = "<%= Session.Timeout %>";
          sessionTimeoutWarning = sessionTimeoutWarning - 1;
          var sessionTimeout = "<%= Session.Timeout %>";
          var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000;
          setTimeout('SessionWarning()', sTimeout);
 

          function SessionWarning() {
              var message = "Your session will expire in another " + (parseInt(sessionTimeout) - parseInt(sessionTimeoutWarning)) + " minute(s)! Please respond before the session expires";
              alert(message);
 
          }
      }
  </script
>
 
This function automatically goes to sessionexpired page after specified time in firefox..but in chrome the alert will stay indefintly.if u check alert then it will automatically timeout..
 
please Help me
Thanks advnc
Aatif-Bangalore
Posted 8-Jul-13 23:14pm
Edited 8-Jul-13 23:15pm
v2
Comments
Samresh.ss at 9-Jul-13 5:28am
   
setTimeout works in my version of chrome. Must be some other issue. Press ctrl+shift+J and see if you see some error in console.
Aatif Ali from Bangalore at 9-Jul-13 5:35am
   
Its working partially...In firefox the alert will automatically closed and page redirect to ma specified url..but in chrome the alert will showing indefinitly..It will close whenvr clicking on alert box.and control redirect to specified url at the clicking time.
Member 9438513 at 27-Jan-14 6:40am
   
I am having same problem, can any one please post solution, if this problem related to alert how it is resolved , put solution plz..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try below one :
 
setTimeout(function () {SessionWarning();}, sTimeout);
 
Useful link : http://www.jquery4u.com/jquery-functions/settimeout-example/[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Sory frnds...actually the problem related with alert() function...not related with SetTimeout()..
 
I replace the alert () with one custom control
  Permalink  
Comments
Member 9438513 at 27-Jan-14 6:40am
   
Please share solution related to alert , i m having same problem..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 389
1 Nirav Prabtani 268
2 Richard Deeming 250
3 _Amy 185
4 CHill60 170
0 OriginalGriff 8,104
1 Sergey Alexandrovich Kryukov 7,067
2 Maciej Los 4,039
3 Peter Leow 3,738
4 CHill60 2,912


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100