473,503 Members | 972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Back Button POST Issue

Is there any way of disabling the repost of information when a user
hits the back button?

Is the only way to do this to actually use some sort of redirect on the
page receiving the initial post (though this won't stop them hitting
back twice and possibly reposting will it?)

Thanks,

Rick

Jan 27 '06 #1
4 3021
Jon
There isn't a true way too that I know. You could always disable the back
button with JS, but that's usually really annoying for users. I usually
write code against the condition. What I'll do is come up with the scenario
on every page that posts info (in particular inserting of records to a DB)
and ask 'what if the user clicks refresh or back'. Think about the queries,
and write some validation that ensures if they do happen to hit back, AND
they ignore the warning that a browser will throw, it won't matter anyways.
Sometimes it's difficult to write, but usually it's not a big deal.

If there is a way to disable POST data on a refresh, I'd love to know how
though :)

"thehuby" <th*****@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Is there any way of disabling the repost of information when a user
hits the back button?

Is the only way to do this to actually use some sort of redirect on the
page receiving the initial post (though this won't stop them hitting
back twice and possibly reposting will it?)

Thanks,

Rick

Jan 27 '06 #2

thehuby wrote:
Is there any way of disabling the repost of information when a user
hits the back button?

Is the only way to do this to actually use some sort of redirect on the
page receiving the initial post (though this won't stop them hitting
back twice and possibly reposting will it?)


That's the way to do it. A browser will only put actual pages into the
history. A POST that doesn't not produce a page, but instead, redirects
to a GET for presentation will not cause the repost warning. And if the
new URL matches exactly that of the page containing the form, the
browser (IE at least), will treat it as though the user has not left
the page at all.

Jan 27 '06 #3
d
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...

thehuby wrote:
Is there any way of disabling the repost of information when a user
hits the back button?

Is the only way to do this to actually use some sort of redirect on the
page receiving the initial post (though this won't stop them hitting
back twice and possibly reposting will it?)


That's the way to do it. A browser will only put actual pages into the
history. A POST that doesn't not produce a page, but instead, redirects
to a GET for presentation will not cause the repost warning. And if the
new URL matches exactly that of the page containing the form, the
browser (IE at least), will treat it as though the user has not left
the page at all.


Exactly. I use this technique all the time, and it works fine on every
browser I've tested it on.
Jan 27 '06 #4
Jon
Awesome - thanks for the algorithm guys - this will save me a bit of time
with validation :)

"d" <d@example.com> wrote in message
news:Q7*****************@text.news.blueyonder.co.u k...
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...

thehuby wrote:
Is there any way of disabling the repost of information when a user
hits the back button?

Is the only way to do this to actually use some sort of redirect on the
page receiving the initial post (though this won't stop them hitting
back twice and possibly reposting will it?)


That's the way to do it. A browser will only put actual pages into the
history. A POST that doesn't not produce a page, but instead, redirects
to a GET for presentation will not cause the repost warning. And if the
new URL matches exactly that of the page containing the form, the
browser (IE at least), will treat it as though the user has not left
the page at all.


Exactly. I use this technique all the time, and it works fine on every
browser I've tested it on.

Jan 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3831
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form.
8
6121
by: Shimon Sim | last post by:
Hi, Every time I write ASP.NET application I have the same problem - Back button on the browser is my enemy. I have to tell client avoid using "Back" button and if you use it make sure to refresh...
29
3952
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
4
8144
by: jwlum | last post by:
I have the following problem under Internet Explorer only: 1. User fills out form data (myform.php) and clicks a button that fires myFunction() 2. myFunction() spawns a "hello, world" popup page...
1
2183
by: nileshsoni21 | last post by:
I have come across a strange behaviour in ASP or rather it could be a HTML or Browser Issue. The browser here is IE. The requirement is to re-load the page whenever user click back button of the...
5
2986
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each...
23
14450
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to retype it. It's obvious that only a few or none of...
4
1241
by: Mike Scholl | last post by:
I have written my first bit of php/sql code and set up a website with a small database. I use a html form and submit button to add/edit etc data. If you are editing data, after you have...
5
4484
by: voidinutah | last post by:
Hello, I'm new to .NET and was trying to find a solution for having a button control do a post back then execute a javascript function. When the button is clicked a post back occurs to save...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7463
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.