Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Redirection problem with Javascript

843838Jan 31 2006 — edited May 11 2007
Following 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2007
Added on Jan 31 2006
2 comments
78 views