Using Cold Fusion, how can I prevent a user from using the back button on the browser

In my Cold Fusion shopping cart I want to make sure the user can not hit the back button and go back once they have completed the transaction.

Otherwise they will get double charged.

Is there a way that when they hit my receipt page I can disable or redirect the back button on the browser?

I don't control the page just prior to my receipt page.  The card processing company controls that.

bigmikey88Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

azadisaryevCommented:
no, you can't control the browser's back button in any way (thanks god!).
and most modern browsers do not allow you to employ the tricks that used to be used to not allow a user to leave the page...

all you can really do is put a big sign on your page saying "Whatever you do - DO NOT PRESS THE BACK BUTTON! You will be double-charged for the goods/services!"

it should really be your sopping cart provider's responsibility to ensure that users who click "back" button from your return page are not double-charged.

Azadi

0
bigmikey88Author Commented:
I've always felt that sites that have to have big warnings like that means the developers could not find a more user friendly solution.

0
azadisaryevCommented:
not always. like in this case - there is really nothing you can do. you can't change any browser features: you just do not have that control over the user's browser (thanks god again!).
i, for one, would be totally appalled and extremely angry if some website made any changes to MY browser settings!

and even there is some ActiveX control that can do this (never mind that it will only work in IE), the user will have to agree to install it first, and that still does not solve all the problems: what if i press Alt+left arrow instead of clicking the Back button? or go into my History and click on the entry for the previous page?

if you google "disable back button" you will see how futile any attempts are (thanks god once again!)

Azadi
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

bigmikey88Author Commented:
is there a way to erase the History object or change it to point to some other page.

If the visitor presses the back button, it reloads the page of my credit card processor and thus charges the person again.

I'm trying to prevent that, not hijack the user.
0
azadisaryevCommented:
you can't erase the history in user's browser.

instead of trying the futile hacks to disable the back button/history, you should talk to your cc processing company and ask them what and how you should do to prevent this - if it's a proper payment processing company they will have the necessary mechanisms in place already to prevent this from happening.

usually, when you try to go back to the payment processing page (and even further back through the payment process), it will display a warning that the page has expired and will NOT process the payment anew... at least that's what i have seen on good payment processing sites...

Azadi
0
PluckaCommented:
You cant control it.

The best solution is to have something happening on the current page to show the user some action is taking place.

An animated progress bar / wheel etc

And something that says please wait, don't click anything.
0
azadisaryevCommented:
if you are REALLY set on 'disabling' the back button, then make sure you read these:

http://www.boutell.com/newfaq/creating/backbutton.html
http://www.boutell.com/newfaq/creating/disableclose

Azadi
0
ZvonkoSystems architectCommented:
Put on your pages this snippet:
<script>window.history.forward(1)</script>
// OR:
<script>window.history.go(1)</script>

Open in new window

0
ZvonkoSystems architectCommented:
"is there a way to erase the History object or change it to point to some other page."
for that is the JavaScript method:
window.location.replace("yourpage.cfm");

As a side effect it clears the browser history for current window.


0
bigmikey88Author Commented:
OK,

I found a solution that is user friendly and does not mess with the browsers back button, which I agree is something not to be tampered with.

The flow of my pages was:

1) checkout page where we get the user's credit card number
2) Credit card processor page (controlled by CC company, not me)
3) Interpret Results from CC processor
4) Receipt page

The problem was that if a visitor at the Receipt page hit the back button they would rerun the credit card processor page (page 2) and get  charged again.

The back button should have taken them to page 3 where I interpret the response from the credit card company.  But instead they went to page 2. Why? see below...

The reason is that page 3 had an include statement to take the user to the receipt (page 4)  if the credit card was good.  

That include statement made the browser think that page 3 and page 4 were one and the same.  

I replaced the include statement on page 3 with a form that gets auto submitted if the credit card is good.

The form seems to create some kind of hard separation so the browser now sees page 4 and page 3 as being different pages.  So when you are on page 4 and hit the back button you go to page 3.  

The include statement caused the browser (IE) to go from page 4 to page 2.

So it's fixed all without resorting to javascript and screwing with the browser.

 My users should have a good experience.  They can still hammer on the back button as much as they want and they can work their way back to page 2 but by then I can remove the credit card variables and prevent multiple charges.

Thank you all for participating.
 



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.