Link to home
Start Free TrialLog in
Avatar of F1stu
F1stu

asked on

back button or refresh page onload

hi,
Does anybody know how to detect when the user click on the back button to go back to the previous page?
Or a way to refresh a jsp page whenever it's loaded?

Thank you. :)
ASKER CERTIFIED SOLUTION
Avatar of mark-b
mark-b
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you have this in your <HEAD> part of HTML coding...

<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="cache-control" content="no-cache"/>

You can use a META tag with an HTTP-EQUIV attribute to control the action of browsers, by setting the HTTP headers. The "Refresh" value can be used to specify a delay in seconds before the browser automatically reloads the document. Optionally, you can also specify an alternative URL to load.

For example, the following tag loads the page yours.jsp after 5 seconds.

<META HTTP-EQUIV="Refresh" CONTENT="5;URL=yours.jsp">

A fine tutorial for the META-Tag: HTTP-EQUIV:
http://www.wdvl.com/Authoring/HTML/Head/Meta/HTTP.html
Avatar of SweetChastity
SweetChastity

We work together.  Our pages use a header and footer that contain opening and closing tags for <html> and <body>, this is used to create consistency.  I had a similiar issue and I found solutions to refreshing in meta and body tags which unfortunately we are not able to implement.  I didn't find anything suggesting we could detect when the user had clicked the back button on internet explorer but would be useful to know.
Avatar of F1stu

ASKER

Hi,

Thanks for all of your help!
Mark's replied helped a lot and it works too.  Thanks! :)

Thank you all very much!
i tried the same solution that mark had given...but it does not work for me...i m using struts framework. has this anything to do with this not working.
What does not work?  
When you press the back button, does the server not get hit?
What browser are you using?