先上效果图:
代码就如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();
});