Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用jsp/servlet在iframe中出现会话注销页面问题_Java_Jquery_Jsp_Iframe_Session Timeout - Fatal编程技术网

Java 使用jsp/servlet在iframe中出现会话注销页面问题

Java 使用jsp/servlet在iframe中出现会话注销页面问题,java,jquery,jsp,iframe,session-timeout,Java,Jquery,Jsp,Iframe,Session Timeout,您好,我正在使用jsp/sevlet在web应用程序中工作,我在iframe中面临会话注销页面问题 我在我的父页面中使用以下代码进行会话超时 <script type="text/javascript"> idleTime = 0; $(document).ready(function () { //Increment the idle time 2ounter every minute. var idleInterval = set

您好,我正在使用jsp/sevlet在web应用程序中工作,我在iframe中面临会话注销页面问题

我在我的父页面中使用以下代码进行会话超时

<script type="text/javascript">
    idleTime = 0;
    $(document).ready(function () {
        //Increment the idle time 2ounter every minute.
        var idleInterval = setInterval("timerIncrement()", 60000); // 1 minute

        //Zero the idle timer on mouse movement.
        $(this).mousemove(function (e) {
            idleTime = 0;
        });
        $(this).keypress(function (e) {
            idleTime = 0;
        });
    })
    function timerIncrement() {
        idleTime = idleTime + 1;
        if (idleTime == 15) { // 15 minutes
           window.location = "logoutPage.jsp"
        }
    }
</script>​​​​​​​​​​​​​​​​​​​​

空闲时间=0;
$(文档).ready(函数(){
//每分钟增加一次怠速时间2。
var idleInterval=setInterval(“timerIncrement()”,60000);//1分钟
//将鼠标移动时的空闲计时器归零。
$(this).mousemove(函数(e){
空闲时间=0;
});
$(此)。按键(功能(e){
空闲时间=0;
});
})
函数timerIncrement(){
空闲时间=空闲时间+1;
如果(空闲时间==15){//15分钟
window.location=“logoutPage.jsp”
}
}
​​​​​​​​​​​​​​​​​​​​
我面临的问题是,如果进程在my iframe页面中运行超过会话时间限制,那么父页面是idel,因此它会自动注销

在另一种情况下,如果我在我的iframe页面中使用会话超时代码,那么问题是

注销页面将进入iframe页面

有什么建议或其他解释来解开这个谜吗?
如果您认为可以,请告诉我

iframe
放在不同的页面中,并使用JSP的
include
标记将该页面包含在主页中

然后试试看


实际上,我认为
iframe
与父页面不同。

最终我找到了iframe问题的解决方案

自动跳出iframe

Iframe代表内联帧。Iframe是一种浮动框架,可以插入网页中的任何位置

网站管理员对iframe的一个担忧是,iframe可用于将网站上的页面包含到外部网站中

如何防止其他网站通过iframe包含您网站上的页面

将以下javascript代码放在您网站上所有页面的顶部,可以确保如果任何其他网站在您的网站上构建了一个页面,那么您的页面将脱离iframe并仅在用户浏览器中显示您的页面

<script type="text/javascript">
<!--
    if (top.location!= self.location) {
        top.location = self.location.href
                   //or you can use your logout page as
                   //top.location='logout.jsp' here...
    }
//-->
</script>

在整个站点上实现iframe代码突破的最佳方法是将代码放入外部javascript文件中,并将其包含在公共模板文件中


这对那些充满神秘感的朋友来说是很有用的…

所以你不想在父/帧页面中复制这段代码,并且仍然能够实现目标?在父/帧页面中复制这段代码也会导致同样的问题。实际上,包含该页面对我没有帮助。。因为在iframe内部,将运行5到6页。。我想在此iframe中显示的所有页面,请提供任何其他解决方案