Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > javascript browser refresh buton

Reply
Thread Tools

javascript browser refresh buton

 
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      10-14-2005
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.


 
Reply With Quote
 
 
 
 
Jack Li
Guest
Posts: n/a
 
      10-14-2005
I don't think so...

Regards,
Jack Li
MVP (ASP.NET)

"Andrew" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
 
Leon Mayne [MVP]
Guest
Posts: n/a
 
      10-14-2005
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();">


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      10-14-2005
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" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      10-14-2005
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" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
> > 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.
> >
> >

>
>
>

 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      10-14-2005
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" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> a écrit dans le message de
> > news:(E-Mail Removed)...
> > > 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.
> > >
> > >

> >
> >
> >



 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      01-12-2009
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=en...G=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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript to disable the REFRESH functionality in a browser Matt HTML 4 09-21-2010 06:59 AM
IE7 OPEN.window previous buton and url pcouas Javascript 2 02-21-2007 06:06 PM
javascript buton click TJS ASP .Net 1 03-10-2005 11:31 AM
Can I add an image to a datagrid link buton column? MattB ASP .Net 0 03-08-2005 03:53 PM
Buton Back. Vincent M. Javascript 1 09-29-2003 07:35 PM



Advertisments