Keep pages out of history

C

Colin Steadman

I'm setting up an intranet site which allows users to update a
database from the web. This works great so far, but there is... not
so much a problem, but an unwanted behavior that I would like to get
rid of.

Basically when a user updates something in the database from
PAGE1.ASP, I forward the user to a page called MESSAGES.ASP and either
display a success/failure message as appropriate. The following tag
then forwards the user to PAGE2.ASP after 2 seconds.

<meta http-equiv=refresh content=2;url=PAGE2.ASP>

There is a back button in PAGE2.ASP which the user can click to get
back to PAGE1.ASP. So far so good!

The problem is, if the user clicks the back button in the browser
instead of my back button, the user is redirected to the MESSAGES.ASP
page and not the PAGE1.ASP page as expected (we dont need to see the
message again)!

Is there anything I can do to avoid this as things get confusing very
quickly when this happens!

TIA,

Colin
 
M

Matthias Gutfeldt

Colin said:
I'm setting up an intranet site which allows users to update a
database from the web. This works great so far, but there is... not
so much a problem, but an unwanted behavior that I would like to get
rid of.

Basically when a user updates something in the database from
PAGE1.ASP, I forward the user to a page called MESSAGES.ASP and either
display a success/failure message as appropriate. The following tag
then forwards the user to PAGE2.ASP after 2 seconds.

<meta http-equiv=refresh content=2;url=PAGE2.ASP>

There is a back button in PAGE2.ASP which the user can click to get
back to PAGE1.ASP. So far so good!

The problem is, if the user clicks the back button in the browser
instead of my back button, the user is redirected to the MESSAGES.ASP
page and not the PAGE1.ASP page as expected (we dont need to see the
message again)!

Is there anything I can do to avoid this as things get confusing very
quickly when this happens!

a) Change the program logic
b) Instruct the users not to use the browser 'Back' button
c) Run it all in a console window so there's no 'Back' button



Matthias
 
R

rf

Colin Steadman said:
I'm setting up an intranet site which allows users to update a
database from the web. This works great so far, but there is... not
so much a problem, but an unwanted behavior that I would like to get
rid of.

Basically when a user updates something in the database from
PAGE1.ASP, I forward the user to a page called MESSAGES.ASP and either
display a success/failure message as appropriate. The following tag
then forwards the user to PAGE2.ASP after 2 seconds.

<meta http-equiv=refresh content=2;url=PAGE2.ASP>

There is a back button in PAGE2.ASP which the user can click to get
back to PAGE1.ASP. So far so good!

The problem is, if the user clicks the back button in the browser
instead of my back button, the user is redirected to the MESSAGES.ASP
page and not the PAGE1.ASP page as expected (we dont need to see the
message again)!

Is there anything I can do to avoid this as things get confusing very
quickly when this happens!

There is no way to fiddle with the browsers history. Code your application
accordingly.

Cheers
Richard.
 
K

Kris

I'm setting up an intranet site which allows users to update a
database from the web. This works great so far, but there is... not
so much a problem, but an unwanted behavior that I would like to get
rid of.

Basically when a user updates something in the database from
PAGE1.ASP, I forward the user to a page called MESSAGES.ASP and either
display a success/failure message as appropriate. The following tag
then forwards the user to PAGE2.ASP after 2 seconds.

<meta http-equiv=refresh content=2;url=PAGE2.ASP>

There is a back button in PAGE2.ASP which the user can click to get
back to PAGE1.ASP. So far so good!

The problem is, if the user clicks the back button in the browser
instead of my back button, the user is redirected to the MESSAGES.ASP
page and not the PAGE1.ASP page as expected (we dont need to see the
message again)!

Is there anything I can do to avoid this as things get confusing very
quickly when this happens!

Display the success-message in the page you are directing to, not
separately; so, don't attempt to mess with back-buttons or browser's
history, instead build your application more robust and usable.

If for instance the redirected page is a list of database items that one
returns to, display the success message above that list, clearly
indicated to draw attention (thick border, anyone?).
 
C

Colin Steadman

Kris said:
Display the success-message in the page you are directing to, not
separately; so, don't attempt to mess with back-buttons or browser's
history, instead build your application more robust and usable.


Bugger, I thought there might be a nice easy META or something I could
use!

If for instance the redirected page is a list of database items that one
returns to, display the success message above that list, clearly
indicated to draw attention (thick border, anyone?).


I think I can do this. But instead of displaying the message above
the data, I think I can display the message own its own first, and
then the database information using some of the script from my
messages.asp page:


<html>
<head>
<title>TEST</title>

<%If Len(Session("message")) > 0 Then
<meta http-equiv="refresh" content="2; url=page1.asp">
<%End If%>

</head>

<body>

<%
If Len(Session("message")) > 0 Then
'Display database update message
Response.write Session("message")
Session("message") = ""
Else
'Display normal page
End If
%>

</body>
</html>


Thanks for your help (+ other contributors).

Colin
 
K

Kris

Bugger, I thought there might be a nice easy META or something I could
use!

I am not so familiar with server side scripting other than some PHP, but
here is how I would do it in PHP. After processing the submitted form
and _before_ returning any data to the user's browser, send a HTTP
location header. It will instantly redirect to the page you specify (the
list I am talking about, for instance). No bypass record in browser
history, because there was simply not an inbetween page visited:

<?

//after processing form and before sending ANY data to the browser
(including spaces or other whitespace characters

header("Location: list.php");

?>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top