Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

58 of 110 people (53%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

Detect Reload so I can have a disabled button after initial click.

Apr 4th, 2008 20:38
ha mo, Iván Rivera, Amit Kulkarni,


Reload is not detectable nor trappable; there is no onReload event
handler. You could try some scheme using onUnload and URL search section
mangling, but onUnload is not guaranteed to work in some browsers for
timing reasons (the handler is out of scope when the page has finished
unloading).
In your case I recommend that you use a cookie. Determine the expiration
period you need (the minimum one is the current session duration, which
is most useful for these cases). At the beginning of your page probe for
the existence of that cookie, and disable your button accordingly.
Remember that form elements have no disabled state in NS4.x, so use the
onFocus="blur()" technique for these browsers. If your button was
generated by a document.write(), you could even choose not to display it.
Hope this helps.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com