Redirection problem with Javascript
843838Jan 31 2006 — edited May 11 2007Following is the javascript code for my QA.jsp page where after 1 minute page would be redirected to QAC.jsp page.
I am using Tomcat.
<html>
<head>
<noscript>
<meta http-equiv="refresh" content="5; URL=QAC.jsp">
</noscript>
<script language="JavaScript">
<!--
var sTargetURL = "QAC.jsp";
function doRedirect()
{
setTimeout( "timedRedirect()", 60*1000 );
}
function timedRedirect()
{
window.location.href = sTargetURL;
}
//-->
</script>
<script language="JavaScript1.1">
<!--
function timedRedirect()
{
window.location.replace( sTargetURL );
}
//-->
</script>
</head>
<body onload="doRedirect()" >
<%
// Some JSP code
%>
</body>
</html>
Now I am facing some problem. When I come to QA.jsp from localhost ie http://localhost:8080/Test/QA.jsp I am able to redirect to QAC.jsp page and do the following processing. But when I come to the page from network ie http://192.168.1.12:8080/Test/QA.jsp it just refreshes QA.jsp but I am not being redirected to QAC.jsp page.
Is there any modifications needed in the Javascript code.
Or can anyone suggest me better approach for timed redirection for JSP.