How to do a Redirect to an HTTP POST Request with Javascript?I summarized 5 ways to redirect URL.(The purpose of below script is to perform a local redirect using Javascript)
1,
- <script language=”javascript” type=”text/javascript”>
- window.location.href=”login.jsp?backurl=”+window.location.href;
- </script>
2,
- <script language=”javascript”>
- alert(”back”);
- window.history.back(-1);
- </script>
3,
- <script language=”javascript”>
- window.navigate(”top.jsp”);
- </script>
4,
- <script language=”JavaScript”>
- self.location=”top.htm”;
- </script>
5,
- <script language=”javascript”>
- alert(”Access Violation”);
- top.location=”error.jsp”;
- </script>

January 21st, 2008
Ntt.cc 








Posted in
Tags: 
RSS Feed
Email Feed
Just be aware of bug 223 in Internet Explorer 6 (and below)
http://webbugtrack.blogspot.com/2007/09/bug-223-magical-http-get-requests-in.html
You will find that in certain cases setting the .href from javascript will NOT work in IE.
Please tell me redirection, if use redirection code
It effect Google search engine ?
It has helped me.
Thanks a lot.
I using 1’st model. Its work, but I can not guarantee google will happy
I’m using number 4.
self.location=”top.htm”;
Works in IE6 and FF3.
Thanx for sharing.
this is good. thanks a lot.
[...] 5 ways to redirect URL with Javascript [...]
I tried option 4 will implementing a solution for CSRF and it works
in IE 7.0 , FF 3.5 and Opera 10.10
Thanks
Raj
Simple implementation of CSRF protection in JSPs:
self.location=”Login.jsp”;
self.location=”Login.jsp”;
Thx a lot, It has helped me.