faqts : Computers : Programming : Languages : JavaScript

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

29 of 47 people (62%) answered Yes
Recently 6 of 10 people (60%) answered Yes


Is there a way to capture if the person has clicked on the refresh button of the browser?
Is there a way to refresh a JSP which is covered by 5-7 frames(wrapper for the site. frameset) ?

Apr 5th, 2008 20:19
ha mo, jsWalter, Jean-Bernard Valentaten, T.J. Funkhouser, Colin Fraser, Ravi Shankar,

Why not use the 'onUnLoad' method?
    <frameset .... onUnLoad='doSomeCk()'>
With this in your top level Frameset, you can do a check when the 
reload button his hit, or when the entire frameset is changed.
Make a decition in this method call and decide what to do.
>> Generally, no, but why would you want to?
>> Examine your logic for asking this question. If you want to create a 
>> situation where data is being updated regularly, then all you need 
>> is a meta statement :   
>> <META HTTP-EQUIV="Refresh" 
>> CONTENT="10;URL=http://www.yourpage.com/this.htm">
>> will automatically refresh your page, from the server, every 10 
>> seconds. 
>> However, if you sre looking just to make sure that the page is 
>> reloaded every so often, then why waste the user's time?
> Reply:  This doesn't really answer my question.  My question wasn't 
> how can I refresh a page automatically, but is there a way to tell if 
> the user has clicked the refresh button.  Here's the background:  
> We're building an online customer care site for our client.  The site 
> is a portal that links 5 sub applications, and the client has 
> required us to use framesets to keep the same look and feel.  We've 
> informed them of the refresh problem with framesets (having to update 
> the frameset definition for each page so that the current page is 
> reloaded when the user hits refresh), but they insisted on using 
> framesets.  So, we have two options.  1) update the frameset 
> definition for each page (this will be a huge performance hit not to 
> mention a pretty major site redesign) or 2) capture when the user 
> clicks the refresh button and instead of reloading the outermost 
> frameset, reload only document.frames[1].  Is this possible?
The refresh-button triggers an event that is out of reach of js, so it 
is not possible to capture it by those means.
Generally all the buttons like "Back", "Forward", "Refresh" etc. are 
out of reach for js.
Sorry, but that's the way it is.
The only workaround that comes to my mind is to place a refresh-button 
inside the webpage (in the navigation-frame for instance) and have the 
user refresh the content by this button. Of course most users will 
still use the usual button, but at least you have an alternative.