Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to get and cancel the reload event (F5, Reload nutton, ...) within a browser

Reply
Thread Tools

How to get and cancel the reload event (F5, Reload nutton, ...) within a browser

 
 
Stefan Mueller
Guest
Posts: n/a
 
      11-04-2005
I've a webpage with a dynamically created table. If the user presses F5,
clicks on the reload button, ... the webpage reloads and the dynamically
created table will be resetted. Is there something like an reload event
which I can test (e.g. with a JavaScript) and ask the user if he/she really
wants to reload the webpage and which I can cancel if the user says that
he/she doesn't want to reload the webpage?

Stefan


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      11-04-2005
Stefan Mueller said the following on 11/3/2005 11:09 PM:
> I've a webpage with a dynamically created table. If the user presses F5,
> clicks on the reload button, ... the webpage reloads and the dynamically
> created table will be resetted. Is there something like an reload event
> which I can test (e.g. with a JavaScript) and ask the user if he/she really
> wants to reload the webpage and which I can cancel if the user says that
> he/she doesn't want to reload the webpage?


You can try onunload and onbeforeunload. But for the most part, you
can't do what you are trying and make it fail proof. Let your users
learn the mistake of waiting to redo what they just screwed up and they
will learn, quicker than you asking them, not to hit the F5 key/Refresh
Button.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
 
Stefan Mueller
Guest
Posts: n/a
 
      11-05-2005
With onUnload I'm able to open a confirm box to ask if the user really'd
like to reload the page. But afterwards I'm not able to prevent the
reloading of the page if the user says 'No'.
However Randy, I guess you're right, I have to educate the users not to
reload the page while filling out the form.

Stefan


 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      11-05-2005

Stefan Mueller wrote:
> With onUnload I'm able to open a confirm box to ask if the user really'd
> like to reload the page. But afterwards I'm not able to prevent the
> reloading of the page if the user says 'No'.
> However Randy, I guess you're right, I have to educate the users not to
> reload the page while filling out the form.


IMHighlyHO it's kind of reverse thinking because your real task is not
to alert users that they gonna loose their input, but ensure that they
will *not* loose their input.
Both IE and Gesko (Firefox inclusive) have special mechanics for it
allowing you to have data store on the client side to keep the current
page snapshot. IE does it through userData behavior, Gesko through
XPCOM interfaces. For ancient (as well as modern but mentally retarded)
browsers you still can semi-mimic it through the cookies (if enabled).
It is not as simple as to disable an interface button but *much* more
convenient and appreciated by the end users.

 
Reply With Quote
 
Stefan Mueller
Guest
Posts: n/a
 
      11-05-2005
Yea, it really makes sense what you say. I'll think about your solution.

Thanks for your reply
Stefan


 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
stumped...table - row - click event, cancel checkbox event dave ASP .Net Building Controls 0 09-02-2006 01:28 AM
Is there an SNMP equivalent to "Reload in [x]" / "Reload cancel" commands? steve.chambers@gmail.com Cisco 5 05-20-2006 04:06 AM
Cancel serverside event using client side event csgraham74 ASP .Net 5 06-14-2005 10:17 PM
HELP CANCEL CANCEL CANCEL Carmen Rosario Computer Support 7 04-06-2005 11:04 PM



Advertisments