All users were logged out of Bugzilla on October 13th, 2018

Javascript timer self.clearTimeout(timerID); ASP.NET postback timer does not restart

RESOLVED INCOMPLETE

Status

()

--
major
RESOLVED INCOMPLETE
10 years ago
8 years ago

People

(Reporter: olga_demi, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [CLOSEME 2010-12-01])

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)

Javascript timer to postback aspx ASP.NET 2.0 page does not work. May be related to 456842?
Visual Studio 2005, ASP.NET 2.0 C# on XP.
Works fine in IE 7, does not in FF 3
Did not test in FF 2.0

Reproducible: Always

Steps to Reproduce:
1. Create an aspx page in VS 2005
2. Add Javascript that posts back every n seconds
3. IE post back happens - javascript timer goes on, FF - postback happens - javascript timer stops
Actual Results:  
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestFFTimer.aspx.cs" Inherits="Cimetrics.BACrestWebApp.TestFFTimer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Test Timer Post Back ASP.NET 2.0 FireFox 3</title>
    <script language="javascript" type="text/javascript" >
<!--
// Script to generate an automatic postBack to the server inside the head tag. 
    var secs = 15;
    var timerID = 0;
    var timerRunning = false;
    //The delaytime is entered as milliseconds.
    var delay = 1000;
    
    function InitializeTimer()
    {
        document.Form1.taSecs.value = "Start Timer";
        // Set the length of the timer, in seconds. 
        secs = 15; 

        StopTheClock();
        StartTheTimer();
    }
    function StopTheClock()
    {
        if(timerRunning)
        {
            self.clearTimeout(timerID);
        }
            
        timerRunning = false;
        document.Form1.taSecs.value =   "Stop Timer";
    }
    function StartTheTimer()
    {       
        document.Form1.taSecs.value = secs + " Seconds";    
        //self.status = secs;
        //alert("StartTheTimer(): secs = " + secs);
        if (secs <= 0)
        {
            StopTheClock();
            // Form1.Post1 is a HTML an input button on your Design form. 
            //document.Form1.Post1.click();
            Post1_onclick();
            //document.Form1.submit();
            //Generated a Postback to the server
            
            // Start the timer again
            InitializeTimer();
        }
        else
        {
            secs = secs - 1;
            timerRunning = true;
            
            timerID = self.setTimeout(function(){ StartTheTimer()}, delay);
        }
    }
    function Post1_onclick() 
    {
       document.Form1.submit();
    }

    function Stop1_onclick() 
    {   
        StopTheClock();
    }

    function Start1_onclick() 
    {
        InitializeTimer();
    }

//-->
</script>

</head>
<body    >

    <form id="Form1" method="post" runat="server" name="Form1" onsubmit="0">
    <div>
        <table>
            <tr >
                <td  colspan = "2">
                    For now only first checked node, click Start Timer and wait 15 sec. Auto post back every 15 seconds adds point value to the ZedGraph. </td>
              
            </tr>
            <tr>
                <td valign="top">
                    </td>
                <td valign="top"  >
 
                    <input id="Post1" type="button" value="Refresh..." onclick="return Post1_onclick()" />&nbsp;
                    <input id="Start1" type="button" value="Start Timer" onclick="return Start1_onclick()" />&nbsp;
                    <input id="Stop1" type="button" value="Stop Timer" onclick="return Stop1_onclick()" />&nbsp;
                    <textarea id="taSecs" cols="20" readonly="readonly" rows="1" style="width: 211px; height: 25px;">First Time Load</textarea>
                    <asp:Label ID="lblError" runat="server" Font-Bold="True" ForeColor="Maroon" Font-Names="Franklin Gothic Medium" Font-Size="Small" EnableViewState="False">
                    </asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>


Expected Results:  
Should postback and restart the timer

Postback and timer is gone. I have both .NET 2.0 and .NET 3.0 installed on my PC.
Reporter, please retest with Firefox 3.6.12 or later in a fresh profile (http://support.mozilla.com/kb/Managing+profiles). Also update your plugins (flash, adobe reader, java, quicktime, silverlight, etc/) Go to the developer's website and download the latest version from there.
Whiteboard: [CLOSEME 2010-12-01]
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.