JavaScript的 - 阿贾克斯 - 就关闭浏览器的JAVA关闭会话 [英] javascript - ajax - to close session on closing browser in JAVA

查看:122
本文介绍了JavaScript的 - 阿贾克斯 - 就关闭浏览器的JAVA关闭会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的web应用程序

1.1I要关闭会话,当用户突然关闭浏览器。

1.1I have to close the session when the user abruptly close the browser.

1.2。当用户试图在新标签中打开 - 用户应该在新的标签被转发到登录页

1.2. When the user tries 'open in a new tab' - The user should be forwarded to the 'login page' in the new tab

我打算使用JavaScript和AJAX的JSPX来实现这一点。

I am planning to use JAVASCRIPT and AJAX to implement this in JSPX.

任何一个可以分享任何样品code来实现他上面我是新来的JavaScript / AJAX?

Can any one share any sample code to implement he above as I am new to javascript/ajax?

推荐答案

这可以通过添加以下META标签在HTML的HEAD来实现。这些标签将清除Cookies当窗口关闭。因此用户需要在下次重新登录。

This can be achieved by adding the following META tags in the HEAD of your HTML. These tags will clear the cookies when the window is closed. hence the user need to relogin the next time.

<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>

这篇关于JavaScript的 - 阿贾克斯 - 就关闭浏览器的JAVA关闭会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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