這篇文章給大家分享的是有關web如何實現5分鐘鼠標鍵盤無操作自動退出登陸的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

<html>
<head>
<script type="text/javascript">
function ScreenSaver(settings){
this.settings = settings;
this.nTimeout = this.settings.timeout;
document.body.screenSaver = this;
// link in to body events
document.body. = ScreenSaver.prototype.onevent;
document.body. = ScreenSaver.prototype.onevent;
document.body.onkeydown = ScreenSaver.prototype.onevent;
document.body.onkeypress = ScreenSaver.prototype.onevent;
var pThis = this;
var f = function(){pThis.timeout();}
this.timerID = window.setTimeout(f, this.nTimeout);
}
ScreenSaver.prototype.timeout = function(){
if ( !this.saver ){
window.location = '/logout'; //退出登陸功能
}
}
ScreenSaver.prototype.signal = function(){
if ( this.saver ){
this.saver.stop();
}
window.clearTimeout(this.timerID);
var pThis = this;
var f = function(){pThis.timeout();}
this.timerID = window.setTimeout(f, this.nTimeout);
}
ScreenSaver.prototype.onevent = function(e){
this.screenSaver.signal();
}
var saver;
function initScreenSaver(){
//blort;
saver = new ScreenSaver({timeout:5000});
}
window.onload = function(){
initScreenSaver();
}
</script>
</head>
<body>
</p>5秒不動就跳轉
</body>
</html>
感謝各位的閱讀!關于“web如何實現5分鐘鼠標鍵盤無操作自動退出登陸”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
另外有需要云服務器可以了解下創新互聯scvps.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
新聞名稱:web如何實現5分鐘鼠標鍵盤無操作自動退出登陸-創新互聯
文章位置:http://www.yijiale78.com/article26/cspjcg.html
成都網站建設公司_創新互聯,為您提供微信小程序、品牌網站建設、ChatGPT、商城網站、App開發、標簽優化
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯