There is no way to do this from the server side, as no page request is
made (it is loaded from cache), so you will have to use javascript -
here's an example from the web:

-----start-------
<HTML>
<BODY ONLOAD="handleBackButton()">
<FORM NAME="backtrack">
<INPUT TYPE="HIDDEN" NAME="isBack" VALUE="No">
</FORM>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--//
        var isBackDefault="No";
        var isBack;
        
        function handleBackButton(){
           isBack = (isBackDefault != document.backtrack.isBack.value);
           document.backtrack.isBack.value="Yes";
           document.backtrack.isBack.defaultValue="Yes";
        }
        
        function isBackButtonUsed(){
         return isBack;
}
-->
</SCRIPT>
<form>
        <input type=button value="how did I get here?"
onclick="(isBackButtonUsed())? alert('Back button was used'):alert('Page
was loaded normally')">
</form>
</BODY>
</HTML>
-----end-------

note that this approach will detect any load from cache - so the forward
button as well. Once you've detected that the page was loaded from
cache, you can use the javascript location.reload(true) function to
force a reload of the page.

/t


 

>-----Original Message-----
>From: Protoculture [mailto:[EMAIL PROTECTED] 
>Sent: Tuesday, May 03, 2005 5:05 PM
>To: CF-Talk
>Subject: detecting back button for page refresh
>
>Hi All. I would like to detect that the user has clicked the 
>back button. I need to do this in order to get the last value 
>entered in the form. ( currently using session variables to 
>recall the last item searched for ). However as you can guess, 
>by pressing the back button you do not get the lastest session 
>items, you get the old ones. 
>
>any work arounds?
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205411
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to