Forum Moderators: open
I'm testing a PHP shopping cart I have written that uses Paypal. I wondered what would happen if a user follows checkout, gets to paypal page, then clicks back to review the order details on my site.
In firefox it displays a popup:
"to display this page, the application must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
If you click "resend" it returns to the checkout page and loads variables from SESSION - fine.
In IE6 when you hit back after reaching Paypal page it gives:
"The page cannot be displayed. The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings."
The URL of referering page is correct. If you then hit refresh the page loads.
Is this something to do with how different browsers handle POST data? I would like the whole checkout to be smooth, no matter if people hit the back button. Is there anything I can do to prevent these messages?
Thanks
"This has to do with the posting of the data. For each page you are posting data, when you go back your not posting back to the page which returns the error. This is something that works different for each site or browser. Technically, it should not allow going back like that. Unfortunately, there is nothing you can add to the code or to your account to prevent this."
If anyone can think of a way round it let me know. I guess I'll just have to live with it for now.
gets to paypal page, then clicks back to review the order details on my site....In firefox it displays a popup ..."the application must send information that will repeat any action"
So your actions are somehow posting a form to a page before it actually goes to payPal.
Now we're on the payPal page, you hit back, FF wants to post it again. Correct?
Normally, it should just display what's in the browser cache. There are only two conditions (that I can think of ATM) under which FF will "re-post" the previous page data: 1) if you clear the cache, or 2) if something is clearing it for you.
By #2 I mean your server or your script is somehow sending headers to not cache this "previous" page. Alternatively, something in your browser settings might be doing this, but I don't think that's the case, because . . .
IE6...."The page cannot be displayed. The page you are looking for is currently unavailable.
This tells us that when you go back, IE is also not able to use the cached page, so it's trying to do the same thing, except that whatever values are supposed to be present from the initial submit are gone, and what you have here is probably a script error.
So there are probably two things going on:
- Your server configuration, somehow, is not caching the previous page. This could be, for example, some server wide setting or some configuration in PHP, if that's what you're using.
- You may have inadequate error handling in your script, causing IE to display the error when it tries to re-call the page. What I mean by this is when you're on your "cart" page (or whatever) your script is expecting certain inputs to function, if it doesn't get those inputs what does it do? If it just exits immediately without output, this will generally cause a "white page" in PHP, but may be an actual error condition not handled by your script.
One thing you can do in IE - turn off "friendly error messages" in Internet Options. This may give a more "descriptive" error in IE.
Of course most of the IE part is speculation, but I do believe you're experiencing a no-cache condition.
A third possibility, which I've no clue if it's even happening - payPal's interface may be somehow clearing existing cached pages. I've no clue how they would do this, but I know when you move around the payPal site you will often not be able to view previous pages for the same reason, but this is a function within their domain. This one's probably way off the mark and deserves little consideration, but it's a thought.
I turned off 'friendly error messages' and the IE error gives -
"Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button."
I thought I might be able to use $_SERVER['HTTP_REFERER'] to get the refering page, and if its the previous page on my site, display normally, if its from paypal page do something else. Unfortunately $_SERVER['HTTP_REFERER'] always give the refering page from my site. I guess it only stores pages from links, not if you go to another page and hit the back button? Is there something else I could use instead to get the previous page viewed?
There is no problem with adding additional items to cart etc, all the processing is done on seperate process pages with redirects back to the views.
I don't really mind the popups about resending information, it would be nice to get rid of the error page in IE though.
//after solution
It turns out I was directly posting details on the final 2 pages. I changed the POST processing to a seperate page, and now when you go back from paypal, the review page loads session variables, not POST so gives no errors.
Thanks for you help, it's really appreciated