IEMac, POSTed Forms, and Redirects: Certain precautions need to be taken when processing POST method forms when the user has IE for Macintosh.
This article has been archived due to outdated information or poor advice. Read on at your own risk.
Interesting bug I tracked down in one of my sites last night.
- Page A: A form with a lot of checkboxes. (For those of you on Gift Manager, the View/Edit Friends page).
- Page B: An ASP page which processes the form, setting/unsetting values depending on whether boxes were checked or not. It then uses Response.Redirect to bounce the user to
- Page C: An unrelated page, with a random query string for freshness.
Due to the nature of form-submitted checkboxes (a value is sent if checked, nothing is sent if it's not) Page B loops through the available values, setting things one way if passed, another way if not.
Occasionally, users were getting their entire friend list cleared. As though the form were submitted with all boxes unchecked.
The problem, I found, is that when I'm on Page C (after a Response.Redirect, and so the URL looks correct, as though I'm on Page C) if I hit Refresh with IE4.5Mac, it actually re-runs Page B. (After guessing what the problem was, I verified it--hitting refresh on "giftlist.asp?nocache=342341" repeatedly changes the random number, which is set at the bottom of Page B.)
Combine this behavior with IEMac's annoying behavior, where refreshing a page which had form values POSTed to it causes the page to be processed with no form values passed (unlike IEWin's dialog that gives you the choice to re-submit your form), and I had a deadly combination--refreshing a seemingly innocent page was actually re-processing my form as though everyone had been unchecked!
The solution is simple--check to make certain that the submit button passed a value before processing the form--but I thought it was an important situation to point out. When dealing with IEMac and form-processing pages, always make certain that the form was really submitted to the page before doing anything drastic based on un-passed data.