location.replace doesn't seem to work 
Author Message
 location.replace doesn't seem to work

Very simple code but I can't figure out why it won't work as advertised.
I can see that the location replace command executes in debug mode.
but after I go to another page and then click back i still have this page
come up on the screen.


<%Response.Expires = 0%>
<html>
<head>
<SCRIPT Language="Javascript">
  function doReplace() {
   location.replace("d_ForgotPassword1.asp");
     }
</SCRIPT>
</head>
<form NAME="d_senduserpassword" ACTION="d_getUserInfo.asp" Method="post"
onUnload="doReplace()">
<body>
<h1>Your password is.</h1>
<Font Size="2" color="blue"><B><% = Session("UserPassword") %></B></FONT>
<p>&nbsp;</p>
<input TYPE="Image" src="images\btnLeft.gif" Value="Return entry screen"
WIDTH="45" HEIGHT="32" >
</Form>
</body>
</html>

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com



Tue, 29 Oct 2002 03:00:00 GMT  
 location.replace doesn't seem to work
Hi

This will never work...
Just submit the page to it self

Bare bones example
Also assuming you have a valid conn


<%
var err = "";
if(Request.ServerVariables("REQUEST_METHOD") == "POST")
  {
 var rs = conn.Execute("SELECT ID FROM MyTable WHERE Login='" +
Request.Form("Login") +  "'' AND thePassword='" +
Request.Form("thePassword") + "'");
  if(!rs.EOF)
    {
     Session("userID") = rs("ID").value;
      Response.Redirect("GoodUser.asp");
     }
    err ="Invalid username or password";
  }
%>
<html>
<head>
</head>
<body>
<%=err%><br>
<form method="POST" action="THIS-PAGE.asp">
Login<br>
<input type="text" name="Login"></br>
Password<br>
<input type="password" name="thePassword"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>

--
Best Regards
   Vidar Petursson -  MVP
http://www.icysoft.com


No matter where you go there you are.
-

Quote:
> Very simple code but I can't figure out why it won't work as advertised.
> I can see that the location replace command executes in debug mode.
> but after I go to another page and then click back i still have this page
> come up on the screen.


> <%Response.Expires = 0%>
> <html>
> <head>
> <SCRIPT Language="Javascript">
>   function doReplace() {
>    location.replace("d_ForgotPassword1.asp");
>      }
> </SCRIPT>
> </head>
> <form NAME="d_senduserpassword" ACTION="d_getUserInfo.asp" Method="post"
> onUnload="doReplace()">
> <body>
> <h1>Your password is.</h1>
> <Font Size="2" color="blue"><B><% = Session("UserPassword") %></B></FONT>
> <p>&nbsp;</p>
> <input TYPE="Image" src="images\btnLeft.gif" Value="Return entry screen"
> WIDTH="45" HEIGHT="32" >
> </Form>
> </body>
> </html>

> --
> Robert Dufour, MCP, MCT
> President SGI IMS Inc.
> www.sgiims.com



Tue, 29 Oct 2002 03:00:00 GMT  
 location.replace doesn't seem to work
Hi Vidar, Thanks for your reply.
If I understand your code correctly, it looks for a password and shows it to
the user. The problem I'm having is that after the user sees this page once
I do not want it to appear again when he clicks the back button after the
user clicks either on the button on the page or on a back button in the
browser. The Javascript Bible indicated that the way to do this was to use
the location.replace command this would replace the current Url in the
history list on the client side with the url defined in the location.replace
command line, then this page would no longer show up when using back or
forward buttons.
Debugging the application, it looks like the function doReplace does not get
executed when the user either clicks on a back button in the page or on my
submit button. It looks like te onUnload event does not get triggered.

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com

Quote:
> Hi

> This will never work...
> Just submit the page to it self

> Bare bones example
> Also assuming you have a valid conn


> <%
> var err = "";
> if(Request.ServerVariables("REQUEST_METHOD") == "POST")
>   {
>  var rs = conn.Execute("SELECT ID FROM MyTable WHERE Login='" +
> Request.Form("Login") +  "'' AND thePassword='" +
> Request.Form("thePassword") + "'");
>   if(!rs.EOF)
>     {
>      Session("userID") = rs("ID").value;
>       Response.Redirect("GoodUser.asp");
>      }
>     err ="Invalid username or password";
>   }
> %>
> <html>
> <head>
> </head>
> <body>
> <%=err%><br>
> <form method="POST" action="THIS-PAGE.asp">
> Login<br>
> <input type="text" name="Login"></br>
> Password<br>
> <input type="password" name="thePassword"><br>
> <input type="submit" value="Submit">
> </form>
> </body>
> </html>

> --
> Best Regards
>    Vidar Petursson -  MVP
> http://www.icysoft.com


> No matter where you go there you are.
> -


> > Very simple code but I can't figure out why it won't work as advertised.
> > I can see that the location replace command executes in debug mode.
> > but after I go to another page and then click back i still have this
page
> > come up on the screen.


> > <%Response.Expires = 0%>
> > <html>
> > <head>
> > <SCRIPT Language="Javascript">
> >   function doReplace() {
> >    location.replace("d_ForgotPassword1.asp");
> >      }
> > </SCRIPT>
> > </head>
> > <form NAME="d_senduserpassword" ACTION="d_getUserInfo.asp" Method="post"
> > onUnload="doReplace()">
> > <body>
> > <h1>Your password is.</h1>
> > <Font Size="2" color="blue"><B><% = Session("UserPassword")
%></B></FONT>
> > <p>&nbsp;</p>
> > <input TYPE="Image" src="images\btnLeft.gif" Value="Return entry screen"
> > WIDTH="45" HEIGHT="32" >
> > </Form>
> > </body>
> > </html>

> > --
> > Robert Dufour, MCP, MCT
> > President SGI IMS Inc.
> > www.sgiims.com



Wed, 30 Oct 2002 03:00:00 GMT  
 location.replace doesn't seem to work
Further testing:
Even when the doReplace event gets trigerred and  the location.replace line
gets excuted the navigation to the original page via back buttons is still
possible. I used the onsubmit event. this triggers the doReplace function
OK.

--
Robert Dufour, MCP, MCT
President SGI IMS Inc.
www.sgiims.com

Quote:
> Hi

> This will never work...
> Just submit the page to it self

> Bare bones example
> Also assuming you have a valid conn


> <%
> var err = "";
> if(Request.ServerVariables("REQUEST_METHOD") == "POST")
>   {
>  var rs = conn.Execute("SELECT ID FROM MyTable WHERE Login='" +
> Request.Form("Login") +  "'' AND thePassword='" +
> Request.Form("thePassword") + "'");
>   if(!rs.EOF)
>     {
>      Session("userID") = rs("ID").value;
>       Response.Redirect("GoodUser.asp");
>      }
>     err ="Invalid username or password";
>   }
> %>
> <html>
> <head>
> </head>
> <body>
> <%=err%><br>
> <form method="POST" action="THIS-PAGE.asp">
> Login<br>
> <input type="text" name="Login"></br>
> Password<br>
> <input type="password" name="thePassword"><br>
> <input type="submit" value="Submit">
> </form>
> </body>
> </html>

> --
> Best Regards
>    Vidar Petursson -  MVP
> http://www.icysoft.com


> No matter where you go there you are.
> -


> > Very simple code but I can't figure out why it won't work as advertised.
> > I can see that the location replace command executes in debug mode.
> > but after I go to another page and then click back i still have this
page
> > come up on the screen.


> > <%Response.Expires = 0%>
> > <html>
> > <head>
> > <SCRIPT Language="Javascript">
> >   function doReplace() {
> >    location.replace("d_ForgotPassword1.asp");
> >      }
> > </SCRIPT>
> > </head>
> > <form NAME="d_senduserpassword" ACTION="d_getUserInfo.asp" Method="post"
> > onUnload="doReplace()">
> > <body>
> > <h1>Your password is.</h1>
> > <Font Size="2" color="blue"><B><% = Session("UserPassword")
%></B></FONT>
> > <p>&nbsp;</p>
> > <input TYPE="Image" src="images\btnLeft.gif" Value="Return entry screen"
> > WIDTH="45" HEIGHT="32" >
> > </Form>
> > </body>
> > </html>

> > --
> > Robert Dufour, MCP, MCT
> > President SGI IMS Inc.
> > www.sgiims.com



Wed, 30 Oct 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. define a measurement doesn't seem to work

2. comparisons between decimal and hex values doesn't seem to work

3. response.expires doesn't seem to work!

4. My Script...Doesn't Seem to Work

5. CDONTS.DLL doesn't seem to work.

6. STMAdmin.dll to query NT Log doesn't seem to work properly

7. focus() doesn't seem to work in IE-6

8. GS 3.51 on PC doesn't seem to find fonts

9. Why LoadPicture() works on local pathes and doesn't work on the URLS

10. location.replace not working with Internal Hyperlink.

11. works / doesn't work, why?

12. 'history' command doesn't work

 

 
Powered by phpBB® Forum Software