search function question

A place to post thoughts, errors, praise, or other comments about CactiGuide.com
Post Reply
MississippiAl
Posts: 49
Joined: Sun Jul 17, 2011 6:57 pm
Location: Horn Lake MS

search function question

Post by MississippiAl »

I assume it's just me since I can't find any posts or documentation on this but after I've done a search and clicked on one of the resulting posts I'm not able to go back to the search results, I get a webpage has expired message. any idea why?

thanks
User avatar
Rebel Squirrel
Posts: 111
Joined: Mon Jul 24, 2006 10:26 pm
Location: Maine, USA

Post by Rebel Squirrel »

No clue. I get tired of back and forth so I open all the posts I want in new tabs/windows.

What browser are you using?
MississippiAl
Posts: 49
Joined: Sun Jul 17, 2011 6:57 pm
Location: Horn Lake MS

Post by MississippiAl »

ie9
User avatar
CelticRose
Posts: 1621
Joined: Mon Nov 03, 2008 4:17 am
Location: Mesa, AZ
Contact:

Post by CelticRose »

Huh. I use IE9 and when I tried it just now I had the same problem. If you refresh the page and then click "retry" on the resulting popup, you get your search results back. Or you could just avoid the problem altogether by right-clicking on the link to the post and selecting "open in new tab".
My mind works in mysterious ways.

I'm all a-Twitter: http://twitter.com/RosCeilteach

My needlework blog: http://rainbowpincushion.blogspot.com
daiv
Site Admin
Posts: 23625
Joined: Mon Aug 16, 2004 10:15 pm
Location: Long Prairie, MN
Contact:

Post by daiv »

This is a built in function of most every browser. "Page Expired..." is IE's way of putting it. Firefox is a little more clear and says:
Confirm: To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.
However, that probably still leaves a lot of head scratching. Essentially, when YOU input data in a FORM - like a text box with "submit" buttons. That data is sent from your computer to the server. Depending on the script, the server performs some sort of process using the data YOU supplied.

In the case of a search, YOU type in a character string (words) and click "search". The script for a search usually then runs a query on the database to find all instances of that string in particular field in the database. Then most often the results are output to the screen for you to see. Script stops running and you're done.

If you then click on a search result, you are moving to a new page. When you click the "Back" button of your browser, you are now attempting to access a page that was generated based on the string YOU entered. Almost always, this page will break, display an error, or some other unwanted behavior if there is NO input.

As a result, the BROWSER recalls the information that YOU input previously to display that page.

(Think in your mind what the results page of a search looks like. Then imagine what should display there if you did not input anything - the page would most likely be empty!)

This all sounds like a non-issue and the browser should just re-display the SAME page using YOUR previously entered string.

However, here's the rub - many times the page that is called after submitting a form does something that you DO NOT want to have happen more than once. For instance charging a credit card for an order or even just submitting an order. Posting a reply on the forum is another example and that is why you get the links that ask if you want to go to the index or the thread after you post. If you click back and the BROWSER re-sends the form data YOU entered, it will be a double post.

The BROWSER doesn't have any way to know what is happening with the form data that YOU posted. Most scripts are run on the server and only the OUTPUT is sent to the BROWSER. So people creating browsers don't want to make it automatically re-post and nor do they want to force you to re-enter the data. And so they keep the data for re-posting, but make YOU manually confirm the action first.

And that's the story of the three bears.... clear as mud? :blackeye:
All Cacti are succulents, but not all succulents are Cacti
MississippiAl
Posts: 49
Joined: Sun Jul 17, 2011 6:57 pm
Location: Horn Lake MS

Post by MississippiAl »

makes perfect sense Daiv, I'm an old AS400 guy so understand db and query talk well :) I also did Q/A for a few years, so when I get errors I ask questions. Thanks for explaining it. CelticRose, thanks for the work around
daiv
Site Admin
Posts: 23625
Joined: Mon Aug 16, 2004 10:15 pm
Location: Long Prairie, MN
Contact:

Post by daiv »

Hopefully, I didn't drive anybody too crazy with my all-caps emphasis. Trying to highlight the relationship with between the two agents: the user and the browser.

Also, it is possible when building a web page to anticipate this situation and make the choice for the user.

In other words, you can write a script that will not allow a double credit card charge or forum post - time delays, unique keys, etc. - can be checked to prevent unwanted double posting.

A little more tricky is forcing the browser to DO the re-post and display those result when a user hits the back button.

I did this very thing on the "Advanced Search" page here: http://www.cactiguide.com/mastersearch/

If you do a search, click on a result, then hit back - ta da! no expired page!

It is a pain in the rear to do this work around every time you have form data to process and so most programmers just skip it. :roll:
All Cacti are succulents, but not all succulents are Cacti
Post Reply