Click here to Skip to main content
11,935,066 members (50,329 online)
Rate this:
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 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";
      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";

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
Posted 9-Jul-13 0:14am
Edited 9-Jul-13 0:15am
Comments 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 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 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
Please Sign up or sign in to vote.

Solution 1

Try below one :

setTimeout(function () {SessionWarning();}, sTimeout);

Useful link :[^]
Rate this: bad
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
Member 9438513 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2015
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