您的位置:首页 > Web前端 > JavaScript

Extjs监听浏览器刷新、关闭和窗口关闭功能

2017-04-25 16:54 537 查看
先上效果图:



代码就如dubug所示:

Ext.onReady(function(){
Ext.create('Ext.window.Window',{
title:'监听测试' ,
width:400 ,
height:300 ,
layout:'fit' ,
constrain:true ,
modal:true ,
icon:'js/extjs/icons/used/browser_window.png',
listeners:{
'show':function(){
Ext.EventManager.on(window,'beforeunload',function(){
//浏览器刷新或关闭执行
Ext.Msg.alert("提示",'刷新或关闭浏览器');
})
},
'close':function(){
Ext.Msg.alert("提示",'关闭页面');
}
}
}).show();
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: