Connecting Tech Pros Worldwide Forums | Help | Site Map

Back Button POST Issue

thehuby
Guest
 
Posts: n/a
#1: Jan 27 '06
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


Jon
Guest
 
Posts: n/a
#2: Jan 27 '06

re: Back Button POST Issue


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" <thehuby@gmail.com> wrote in message
news:1138352953.363521.10320@f14g2000cwb.googlegro ups.com...[color=blue]
> 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
>[/color]


Chung Leong
Guest
 
Posts: n/a
#3: Jan 27 '06

re: Back Button POST Issue



thehuby wrote:[color=blue]
> 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?)[/color]

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.

d
Guest
 
Posts: n/a
#4: Jan 27 '06

re: Back Button POST Issue


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:1138379070.567367.199370@g14g2000cwa.googlegr oups.com...[color=blue]
>
> thehuby wrote:[color=green]
>> 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?)[/color]
>
> 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.[/color]

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


Jon
Guest
 
Posts: n/a
#5: Jan 27 '06

re: Back Button POST Issue


Awesome - thanks for the algorithm guys - this will save me a bit of time
with validation :)

"d" <d@example.com> wrote in message
news:Q7sCf.10254$wl.6393@text.news.blueyonder.co.u k...[color=blue]
> "Chung Leong" <chernyshevsky@hotmail.com> wrote in message
> news:1138379070.567367.199370@g14g2000cwa.googlegr oups.com...[color=green]
>>
>> thehuby wrote:[color=darkred]
>>> 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?)[/color]
>>
>> 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.[/color]
>
> Exactly. I use this technique all the time, and it works fine on every
> browser I've tested it on.
>[/color]


Closed Thread