javascript browser refresh buton

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5kcmV3?=, Oct 14, 2005.

  1. Hi,

    Is there a javascript code to capture the browser's refresh button click
    event ?
    I know that I can handle that event with some c# code, but I was just
    wondering if that can be done using javascript ?

    Thanks.
    Andrew.
     
    =?Utf-8?B?QW5kcmV3?=, Oct 14, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?QW5kcmV3?=

    Jack Li Guest

    I don't think so...

    Regards,
    Jack Li
    MVP (ASP.NET)

    "Andrew" <> wrote in message
    news:...
    > Hi,
    >
    > Is there a javascript code to capture the browser's refresh button click
    > event ?
    > I know that I can handle that event with some c# code, but I was just
    > wondering if that can be done using javascript ?
    >
    > Thanks.
    > Andrew.
    >
    >
     
    Jack Li, Oct 14, 2005
    #2
    1. Advertising

  3. Andrew wrote:
    > Is there a javascript code to capture the browser's refresh button
    > click event ?
    > I know that I can handle that event with some c# code, but I was just
    > wondering if that can be done using javascript ?


    Not sure about capturing the actual button click event, but you could attach
    some code to fire on another event such as the page onunload event:
    <body onunload="javascript:testCode();">
     
    Leon Mayne [MVP], Oct 14, 2005
    #3
  4. =?Utf-8?B?QW5kcmV3?=

    Patrice Guest

    AFAIK no. You may want to explain what you are trying to do. It could raise
    other suggestions than capturing the refresh button...
    --
    Patrice

    "Andrew" <> a écrit dans le message de
    news:...
    > Hi,
    >
    > Is there a javascript code to capture the browser's refresh button click
    > event ?
    > I know that I can handle that event with some c# code, but I was just
    > wondering if that can be done using javascript ?
    >
    > Thanks.
    > Andrew.
    >
    >
     
    Patrice, Oct 14, 2005
    #4
  5. Hi,

    I have this textbox that I use to display a countdown timer, starting from
    90:00, which is 90 minutes. The problem is that when the user clicks on the
    REFRESH button of the browser, the timer refreshes itself and restarts from
    90 minutes. How can I prevent that from happening and make the counter just
    continue on ?

    The counter value txtclock.value is called from the html body ie.
    onload="start()".

    Thanks.
    Andrew.

    "Patrice" wrote:

    > AFAIK no. You may want to explain what you are trying to do. It could raise
    > other suggestions than capturing the refresh button...
    > --
    > Patrice
    >
    > "Andrew" <> a écrit dans le message de
    > news:...
    > > Hi,
    > >
    > > Is there a javascript code to capture the browser's refresh button click
    > > event ?
    > > I know that I can handle that event with some c# code, but I was just
    > > wondering if that can be done using javascript ?
    > >
    > > Thanks.
    > > Andrew.
    > >
    > >

    >
    >
    >
     
    =?Utf-8?B?QW5kcmV3?=, Oct 14, 2005
    #5
  6. =?Utf-8?B?QW5kcmV3?=

    Patrice Guest

    Keeping the time the counter started for the first time should work.
    If you know the counter started at 11:10 when the page is refreshed at 11:20
    you are able to start the counter for the remaining 80 minutes rather than
    for the initial 90 minutes delay...

    --
    Patrice

    "Andrew" <> a écrit dans le message de
    news:...
    > Hi,
    >
    > I have this textbox that I use to display a countdown timer, starting from
    > 90:00, which is 90 minutes. The problem is that when the user clicks on

    the
    > REFRESH button of the browser, the timer refreshes itself and restarts

    from
    > 90 minutes. How can I prevent that from happening and make the counter

    just
    > continue on ?
    >
    > The counter value txtclock.value is called from the html body ie.
    > onload="start()".
    >
    > Thanks.
    > Andrew.
    >
    > "Patrice" wrote:
    >
    > > AFAIK no. You may want to explain what you are trying to do. It could

    raise
    > > other suggestions than capturing the refresh button...
    > > --
    > > Patrice
    > >
    > > "Andrew" <> a écrit dans le message de
    > > news:...
    > > > Hi,
    > > >
    > > > Is there a javascript code to capture the browser's refresh button

    click
    > > > event ?
    > > > I know that I can handle that event with some c# code, but I was just
    > > > wondering if that can be done using javascript ?
    > > >
    > > > Thanks.
    > > > Andrew.
    > > >
    > > >

    > >
    > >
    > >
     
    Patrice, Oct 14, 2005
    #6
  7. =?Utf-8?B?QW5kcmV3?=

    Hans Kesting Guest

    After serious thinking saurabh kumar manis wrote :
    > I have this textbox that I use to display a countdown timer, starting from
    > 90:00, which is 90 minutes. The problem is that when the user clicks on the
    > REFRESH button of the browser, the timer refreshes itself and restarts from
    > 90 minutes. How can I prevent that from happening and make the counter just
    > continue on ?
    >
    >
    > From
    > http://www.google.co.in/search?hl=e...rts from How can I prevent &btnG=Search&meta=
    >
    > Posted via DevelopmentNow.com Groups
    > http://www.developmentnow.com/g/


    You have to store the required endtime somewhere. On a (re)start of the
    page, check that store. If it is present, calculate the current time
    from there. If it isn't there, create it with the 90 minute timeout.

    For a client-side solution, you would use a cookie.
    A server-side solution usually would use Session to store something
    like this, but those sessions usually time out after 20 minutes of
    inactivity!

    Hans Kesting
     
    Hans Kesting, Jan 12, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB
    Replies:
    0
    Views:
    451
    MattB
    Mar 8, 2005
  2. TJS

    javascript buton click

    TJS, Mar 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    475
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Mar 10, 2005
  3. Matt
    Replies:
    4
    Views:
    35,135
    farukcse
    Sep 21, 2010
  4. Vincent M.

    Buton Back.

    Vincent M., Sep 29, 2003, in forum: Javascript
    Replies:
    1
    Views:
    94
    Lasse Reichstein Nielsen
    Sep 29, 2003
  5. pcouas
    Replies:
    2
    Views:
    139
    Randy Webb
    Feb 21, 2007
Loading...

Share This Page