Link to home
Start Free TrialLog in
Avatar of paul_lau2828
paul_lau2828

asked on

How do I Diable the IE back button in Jscript

We have a serious problem assocated withe the IE Back button. We have developed a logout page that I set the following but it does not work.

<%
Session("MM_2000Connect_STRING") = ""
Session.Abandon()
Response.CacheControl = "no-cache"
%>


The user can still use IE's back button to navigate the previous page with the data and submit the process again. Our users have complety rejected our work because of this.
I have searched through EE and tried all the solution but it DOES not work. As That is so important to us. This question is worth for more than 500 points.

Notes: we are using Jscript
see code logout.page

==========
<!-- static char rcsid[]="$Id: $";
-->
<%@LANGUAGE="JSCRIPT" %>
<%
Session("MM_2000Connect_STRING") = ""
Session.Abandon()
Response.CacheControl = "no-cache"
%>

<%
var FSurname = Request("surname")
var FGName = Request("gname")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>Employee Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #000000;
}
a:link {
      color: #000000;
}
a:visited {
      color: #000000;
}
a:hover {
      color: #FFFF00;
}
a:active {
      color: #000000;
}
.style8 {
      font-size: 18px;
      font-weight: bold;
}
.style9 {
      font-size: 18pt;
      font-weight: bold;
      color: #000066;
}
.style10 {color: #FF0000}
.style11 {
      color: #000000;
      font-style: italic;
}
.style12 {color: #000066; font-size: 18pt;}
.style13 {color: #FFFFFF}
-->
</style>

<script language="javascript">
     window.history.forward(1);
</script>

</head>
<form>
<BODY onLoad="if(history.length>0)history.go(+1)">
<div align="left">
  <table width="100%"  border="0">
    <tr>
      <td height="107" align="right" valign="top"><div align="left"></div></td>
      <td align="right" valign="top"><p><img src="Image/img_crm.jpg" width="386" height="87">
 
     
    </tr>
</table>

</font></td></tr></table>


  </font></td>
</tr></table>

<div align="center">
 </p>
 <p>&nbsp;</p>
 <p><span class="style9"><span class="style10">2000</span><span class="style11">Plus</span> </span><span class="style12">Employee Self Service</span>
  </p>
 <p>&nbsp;</p>
 <p>

<table width="60%"  border="0" align="center">
  <tr>
    <td align="center"><span class="style8">Thank you <%=FGName%>&nbsp;<%=FSurname%>!</span></td>
  </tr>
  <tr>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td width="59%" align="left"><p>
      <STRONG>You have now left the secure areas of 2000Plus Employee Self Services.</STRONG></p>
      <!--p>Remember, you can easily log on again by attempting to access additional secure areas of the American Express website.</p-->
      <P>PLEASE NOTE: If you are leaving your computer unattended, exit your browser software.</P>
      <p>.
      </p></td>
  </tr>
</table>

</p>
</div>
</body>
</form>
</html>


===================== END===========================
Please help this is very urgent



ASKER CERTIFIED SOLUTION
Avatar of apresto
apresto
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This will re-direct the person to the page they tried to go back from
SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> So now, when the user hits back, they will still see the same page, but soon as they press refresh, or submit, they will be redirected to a page telling them that their session has expired and to relogin...

So long as you put the cache headers in like me and eyeh8u suggested ;-)
Avatar of java_programmer
java_programmer

Headers should not matter that much, since the redirect will happen server side ..... but it can't hurt! usually with dynamic web sites, you turn off caching. You can usually do that on the server, instead of modifying every page....
> since the redirect will happen server side

But if the page is cached in the browser, then no call will be made to the server ;-)

We're splitting hairs here though...  I think paul_lau2828  should have his solution by now :-)
Avatar of paul_lau2828

ASKER

Still does NOT WORK as I have tried to use the ways you guys suggested to me. I'm using IE Version 6.0

See code below
===========

<!-- static char rcsid[]="$Id: $";
-->
<%@LANGUAGE="JSCRIPT" %>
<%
Session("MM_2000Connect_STRING") = ""
Session.Abandon()
Response.CacheControl = "no-cache"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript">
     window.history.forward(1);
</script>
<%
var FSurname = Request("surname")
var FGName = Request("gname")
%>
<title>Employee Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #000000;
}
a:link {
      color: #000000;
}
a:visited {
      color: #000000;
}
a:hover {
      color: #FFFF00;
}
a:active {
      color: #000000;
}
.style8 {
      font-size: 18px;
      font-weight: bold;
}
.style9 {
      font-size: 18pt;
      font-weight: bold;
      color: #000066;
}
.style10 {color: #FF0000}
.style11 {
      color: #000000;
      font-style: italic;
}
.style12 {color: #000066; font-size: 18pt;}
.style13 {color: #FFFFFF}
-->
</style>
</head>
<form>
<BODY onLoad="if(history.length>0)history.go(+1)">
<div align="left">
  <table width="100%"  border="0">
    <tr>
      <td height="107" align="right" valign="top"><div align="left"></div></td>
      <td align="right" valign="top"><p><img src="Image/img_crm.jpg" width="386" height="87">
 
     
    </tr>
</table>

</font></td></tr></table>


  </font></td>
</tr></table>

<div align="center">
 </p>
 <p>&nbsp;</p>
 <p><span class="style9"><span class="style10">2000</span><span class="style11">Plus</span> </span><span class="style12">Employee Self Service</span>
  </p>
 <p>&nbsp;</p>
 <p>

<table width="60%"  border="0" align="center">
  <tr>
    <td align="center"><span class="style8">Thank you <%=FGName%>&nbsp;<%=FSurname%>!</span></td>
  </tr>
  <tr>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td width="59%" align="left"><p>
      <STRONG>You have now left the secure areas of 2000Plus Employee Self Services.</STRONG></p>
      <!--p>Remember, you can easily log on again by attempting to access additional secure areas of the American Express website.</p-->
      <P>PLEASE NOTE: If you are leaving your computer unattended, exit your browser software.</P>
      <p>.
      </p></td>
  </tr>
</table>

</p>
</div>
</body>
</form>
</html>


<script language="javascript">
     window.history.forward(1);
</script>

change to

<script language="javascript">
     history.forward();
</script>

Do this work
That link repeats almost exactly what has been said here...

You can't (but there are some things you can do to make your webapp handle it better)
@TimYates yeah, I know, but I thought it was a good article that covered all the ideas in one article, rather than seperate ideas in seperate articles. Handy reference.
Very true :-)