clear session on close of browser jsp
关闭浏览器销毁session
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DetectBrowserClose.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Code to Detect Browser Close Using jQuery In Asp.Net</title> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function () { $(window).bind("beforeunload", function () { return confirm("You are about to close the window"); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> Please click on close window </div> </form> </body> </html>
详情参考:
http://www.aspdotnet-pools.com/2014/06/code-to-detect-browser-close-using.html
作者:习惯沉淀
如果文中有误或对本文有不同的见解,欢迎在评论区留言。
如果觉得文章对你有帮助,请点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
扫码关注一线码农的学习见闻与思考。
回复"大数据","微服务","架构师","面试总结",获取更多学习资源!