Colin Brazier
asked on
Avoid confirm on browser back button
Hi experts,
If I choose one option from a menu, and then hit the browser back button, I am asked to confirm resubmission...is there any way I can avoid having to do this and go straight back to the menu?
I am looking at this from the developer's viewpoint, I don't want my users being asked to confirm after simply hitting the back button.
Or is it by design?
Cheers,
Col
If I choose one option from a menu, and then hit the browser back button, I am asked to confirm resubmission...is there any way I can avoid having to do this and go straight back to the menu?
I am looking at this from the developer's viewpoint, I don't want my users being asked to confirm after simply hitting the back button.
Or is it by design?
Cheers,
Col
my guess is you have put your menu fields in a form. If yes, then its working as designed. However we dont usually use menu in a form.
There are many online menu creators available which you can plugin with your webpage. My personal selection is www.milonic.com
This way you can get out of the confirmation window and it also would give an elegant look n feel.
There are many online menu creators available which you can plugin with your webpage. My personal selection is www.milonic.com
This way you can get out of the confirmation window and it also would give an elegant look n feel.
ASKER
Thanks both.
I only use plugins if they're absolutely necessary, but I'll take a look at it anyway.
Here's the menu code
So the navigation is controlled by $_GET. So by hitting the back button I'd simply want to remove the ?xxx part of the URL. Could you show me the js code I'd need to do this please, as I guess that would be what's needed here.
I only use plugins if they're absolutely necessary, but I'll take a look at it anyway.
Is there any effect from resubmitting the previous page repeatedly?No.
Here's the menu code
<!-- CONTENT START --->
<div id="head_title" class="blue_3">Administration Menu</div>
<img id="head_img" src="../images/smallspheresh.jpg">
<div id="table_box2">
<div>
<p class="con_medium_normal">Welcome to the Website Administration Section</p>
<table id="admin_menu_table">
<tr>
<td colspan=3> </td>
</tr>
<tr>
<td><a href="?wh=teachers" class="button large brown" >Teachers</a></td>
<td><a href="?wh=stop_press" class="button large brown" >Stop Press</a></td>
<td> </td>
</tr>
<tr>
<td colspan=3></td>
</tr>
<tr>
<td><a href="?wh=newsletters" class="button large brown" >Newsletters</a></td>
<td><a href="?wh=letters" class="button large brown" >Letters home</a></td>
<td> </td>
</tr>
<tr>
<td><a href="?wh=diary" class="button large brown" >Diary</a></td>
<td colspan=2 style='height:20px;'> </td>
</tr>
<tr>
<td><a href="?wh=clubs" class="button large brown" >Clubs and Activities</a></td>
<td><a href="?wh=curriculum" class="button large brown" >Curricula</a></td>
<td> </td>
</tr>
<tr>
<td colspan=3></td>
</tr>
<tr>
<td colspan=3><?php include (HTML_PATH.DS.'logout.html.php'); ?></td>
</tr>
</table>
</div>
</div>
So the navigation is controlled by $_GET. So by hitting the back button I'd simply want to remove the ?xxx part of the URL. Could you show me the js code I'd need to do this please, as I guess that would be what's needed here.
I see nothing in this HTML that would trigger a confirmation. Installed on my own server, here:
http://iconoun.com/demo/temp_colinspurs.php
Click around that page a bit and see if you get the confirmation message. I don't. So the effect may be coming from somewhere else.
http://iconoun.com/demo/temp_colinspurs.php
Click around that page a bit and see if you get the confirmation message. I don't. So the effect may be coming from somewhere else.
ASKER
I don't either. I did think it very odd, so it must be coming from somewhere else.
It doesn't matter what option is selected, here's the code from "view source" for the simplest. The html is built by including portions of html (header, content, footer) from a php index file.
ee_source.html
It doesn't matter what option is selected, here's the code from "view source" for the simplest. The html is built by including portions of html (header, content, footer) from a php index file.
ee_source.html
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
OK, will do.
Cheers.
Cheers.
ASKER
Thanks, the delay in getting back to you was because I was re-jigging the code to get rid of all those extra form elements. Seems to be working as required now.
A good understanding of the HTTP protocol will help you see what is happening.
https://www.experts-exchange.com/articles/11271/Understanding-Client-Server-Protocols-and-Web-Applications.html
Here is the usual sequence of events that triggers the confirmation request:
Request #1: Client visits a web page that contains an HTML form with POST-method
Request #2: Client submits the POST-method request
Response: Server does something with the POST request and produces a "thank you" page
Request #3: Client sees the "thank you" and hits the back button, causing the POST request to be submitted again
This used to be a problem in about 1999 when clients would accidentally pay for things twice or three times by hitting the back button to see if slow, balky servers were actually getting their orders. Today we use cookies, databases, and other tools to prevent duplicate submissions, so it's less of a problem.