Solved

Browser Back Button Issues

Posted on 2013-11-16
3
331 Views
Last Modified: 2013-11-16
Hello,

Please do this:

(1) Go to tchristy.net.

(2) Enter the term "Sprayer" (without the quotes) into the search filed, upper right.

(3) Click Search.

(4) It produces a page with three items.

(5) Click the middle item (4 1/2 Gallon Back Pack Sprayer).

(6) On the detail page, click the browser back button. You get "Document Expired" in Firefox (not sure in other browsers).

The customer expects the "back" button to go back to the search page.

Of course all this is dynamically generated out of a database. I understand the back button issues.

Can I get control of the back button (in Javascript) and, in effect, return to the search page? I can of course save the search string in a session variable, etc.

I know there are messy issues trying to "control" the back button.
0
Comment
Question by:Richard Korts
3 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
Comment Utility
Line 67 of the generated HTML contains this:

<form method="post" id="searchform" action="product_search.php">

The POST method is inappropriate for requests that do not change the state of the data model.  If you change to use GET, you'll avoid this issue and your clients will be able to bookmark the pages, send links to friends, etc.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
I don't think this is a back button problem.  While I don't believe that you will get what you are looking for, it also looks like you have put up 'cache prevention' code on that page.  On my pages similar to this, I at least get the main page without the previous results.  Ray's suggestion of using GET which puts the seaarch request in a URL query string may solve the problem also.
0
 

Author Closing Comment

by:Richard Korts
Comment Utility
Works like a charm. I don't know why, but hey.................
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now