468,249 Members | 1,509 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

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 2830
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Shimon Sim | last post: by
29 posts views Thread by Tom wilson | last post: by
1 post views Thread by nileshsoni21 | last post: by
5 posts views Thread by ns21 | last post: by
4 posts views Thread by Mike Scholl | last post: by
5 posts views Thread by voidinutah | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.