Mark, I've been wrestling with this issue myself lately. There is no direct and easy way that I've found. It depends largely on what the context is. For example, if you have a five-page registration procedure and don't want the user to go back using the browser buttons from 4 to 3, you can enforce the flow by only allowing 3 to accept a referring page of 2. In all other cases, you CFLOCATION back to the referring page. But this could be very user-unfriendly.
If you don't know what the previous page is, you could do the old annoying standby of putting a meta refresh page before the page in question, so that any single click on the back button bounces them forward again. The most friendly, but not completely enforceable method I've found is to use the onBeforeUnload() JavaScript event that IE recognizes. (I am lucky enough to have a user base limited to one browser.) Toward the top of the page, you use this JS to set a variable: var properExit = "false"; You also add this function: function confirmExit() { if (properExit != "true") { return "Use of your browser's back buttons may cause problems with the site. Please click Cancel and use the appropriate buttons within the form."; } } In the page's body tag, you add the onBeforeUnload attribute as below: <BODY ... onBeforeUnload='return confirmExit();'> If you have any buttons or hyperlinks on the page that are "allowable" exits, then add the onClick attribute as below: <INPUT type='image' name='submit' ... onClick='properExit="true";'> ..or... <A HREF='www.yahoo.com' ... onClick='properExit="true";'> This way, on exit that uses a browser button (Back, Forward, and Refresh/Reload all trigger this), the user is prompted with the message in the confirmExit function. There is no way that I've found to force cancellation of the page move, but this at least lets you ask the user nicely, at which point they can choose to cancel the move. Hope this helps, Matthieu -----Original Message----- From: Mark Smeets [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 1:19 PM To: CF-Talk Subject: Preventing user from going back Hey all, Does anyone have an easy way to prevent the user from going back to the previous page? -------------------------------------- Mark Smeets / stranger0 / ICQ: 1062196 [EMAIL PROTECTED] http://www.prowerks.com/stranger "Life is a series of small victories" - Gene Simmons FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists