FireFox - Check for newer versions of Stored Pages

Internet Explorer allows users to change a setting that has the browser check for newer versions of Stored Pages each time one visits the page.

In IE, go to Settings > Internet Options > General Settings Tab > "Browsing History" section > Settings. Then check "Every time I visit a page".

In Firefox, this is trickier, but here's how to do it.....

Type "about.config" in your URL and hit Enter. Scroll down until you find the setting for "browser.cache.check_doc_frequency" and double click the 3. Change the 3 to a 1. This will force Firefox to check for a new page every time you visit a web page.

Preventing Browser Back Button Resubmissions

How do you prevent a form resubmission using the back browser button?

This problem came up for me on some old legacy code, a shopping cart. A user would go through the view cart form, the shipping section and then click the checkout button. If the user would then click on the browser back button, the same checkout form and checkout button would display. The user could then click the checkout button again and reorder, submitting the exact same information.

There's all kinds of things wrong with this scenario but I will just offer a couple of solutions.

First off the best way to prevent this browser back button resubmission is to have a 3 template process.

  1. The form template
  2. The action template where the form is processed, query inserts, cfmail, etc.
  3. The redirection page or thank you page.
The end of your action template would have a redirection to the thank you page. After all the code to process the submitted form variables, down at the bottom, have a to the thank you template. When the user attempts to hit the back browser button, the page will have expired. It would be best if you had code accepting submissions only from the original form template, with a redirection to a 404 or some other page.

Another solution could be to attempt to disable the browser back button with JavaScript. A little research revealed that this was not the proper methodology, interfering with the user's experience, and other ethical or touch feely rationale. Plus it occurred to me that this would probably not work on all browsers and probably take a while to come up with a thoroughly safeguarded JavaScript. Pass.

In my case, I didn't want to rewrite a whole bunch of existing and mostly operating code, so I came up with another solution. The code with which I was working had the thank you template included in the action template. It could not easily have been broken out, there were too many variables set within the action template that were required within the thank you page. The thank you template was a complete order review for the transaction.

The minimalistic approach that I took was to create and add this bit of code:

view plain print about
1<!--- to prevent resubmission using browser back button --->
2<cfif structKeyExists(session,"submittedAlready")>
3    <cfset StructDelete(session,"submittedAlready") />
4    <cflocation url="viewCart.cfm" addtoken="false" />
5<cfelse>
6    <cfset session.submittedAlready = "true" />
7</cfif>

Let's go over this snippet starting with the 5th line.

view plain print about
1<cfset session.submittedAlready = "true" />

We are setting a session variable that tells us the form has been submitted and processed already. If the user attempts to go back using the browser back button and resubmit the same form, we catch it with our check for the existence of that specific session variable.

view plain print about
1<cfif structKeyExists(session,"submittedAlready")>

If it has been submitted, we redirect, in this case, back to their empty cart. You could redirect to a notification of attempted resubmission too. That's up to you.

I threw in the StructDelete, deleting the existence of the session variable because:

  1. We don't need the session variable anymore, and
  2. It would block the user from using the form again. The user may have to go back and order something else they had forgotten, or submit different information using the same form. If we do not clear out this session variable, it will prevent them from filling out the form with new information.

One more thing. Where do we place this code?
It goes on your action template before you do any form processing.

And there you have the quick and easy way to prevent users browsing backwards to the same form and resubmitting the same information – repeating submissions.

Broken Mura Form Editor

A set of forgotten double quotes on an input tag completely broke the Mura Form Editor in Google Chrome 9.0.597.107.

I like to use one type of browser to administer Mura (Chrome) and another (Firefox) to view the site's pages. The Mura's toolbar interferes with the CSS, rendering the page undesirably.

Changing a Submit button to an image incorrectly:

From:

view plain print about
1<img src="img/submit button.jpg" style="cursor:pointer;" onclick="submitForm()">

To:

view plain print about
1<input type="image src="img/submit button.jpg" style="cursor:pointer;" >

(notice the missing double quotes after

view plain print about
1type="image

Saved OK, but when and displayed almost correctly in the browser, minus the Submit button image, of course. But, back in the Mura Admin in Google Chrome, the Edit Form section would not display the content area at all. Not only that, the whole Mura Admin tab, in Chrome, locked up. Reloading did not fix it. The only way to get the Mura Admin functionality going again was adjusting the URL and going to another section in the Admin.

Panic strikes! If I am unable to edit the Form through Mura, I'll have to go into the database, find which table and which row and which column I will have to edit. (That would be the "Body" column of the "tcontent" table searching on the ContentID, which I happened to know.)

But alas! There is no need to go digging through your database. Simply open up another browser, login to Mura Admin and fix the form. IE8 and Firefox 3.6 both were able to open the broken form in Mura's Form Editor.

BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Blog Owner