使用jsp/servlet的iframe中的会话注销页面问题 [英] session logout page issue in iframe using jsp/servlet

查看:91
本文介绍了使用jsp/servlet的iframe中的会话注销页面问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Hi i'm working in the web application using jsp/sevlet,i'm facing the session logout page issue in iframe

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

i use the following code in my parent page for my session time out

<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>​​​​​​​​​​​​​​​​​​​​

我面临的问题是,如果某个进程的运行时间超出了我的iframe页面中的会话时间限制,则父页面为idel,因此它会自动注销

the issue i'm facing is , in case a process is running beyond the session time limit in the my iframe page then the parent page is idel so it automatically getting logout

在其他情况下,如果我在iframe页面中使用了会话超时代码,则问题是

in other case if i use the session time out code in the my iframe page then the issue is

退出页面进入iframe页面

the logout page is coming inside the iframe page

对于解决这个奥秘有任何建议或其他解释吗? 请让我知道

Any suggestions or other explanations for solving this mystery? Please let me know

推荐答案

最后,我找到了解决iframe问题的方法

Finally i found the solution for Iframe issue

自动脱离iframe

Automatically break out of an iframe

iframe代表嵌入式框架. Iframe是一种浮动框架,可以插入网页内的任何位置.

Iframe stands for inline frame. An Iframe is a floating frame that can be inserted anywhere within a web page.

网站管理员对iframe的关注是,iframe可用于将您网站上的页面包含到外部网站中.

A concern for webmasters about iframes is that an iframe can be used to include pages on your website into external sites.

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

How do you prevent pages on your website from being included through an iframe by another website?

将以下javascript代码放在您网站上所有页面的顶部,可以确保如果其他网站对您网站上的某个页面进行了内嵌框架,则该页面将脱离iframe,仅在用户浏览器中显示您的页面.

Placing the following javascript code at the top of all pages on your site will ensure that if any other site iframes a page on your website, that your page will break out of the iframe and just display your page in the users browser.

<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文件中,并将其包含在通用模板文件中.

The best way to implement this break out of an iframe code on an entire site is to put the code into an external javascript file, and include it in a common template file..

这对于那些充满这种神秘感的伙伴很有用.....

This will be useful for the buddies who fraught with these kind of mystery.....

这篇关于使用jsp/servlet的iframe中的会话注销页面问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆