监听IE关闭
- Java code
<script language=”JavaScript” type=”text/javascript”> //------------------------------------------------------- // Specifies a function for the window's onbeforeunload event // Call back to the getUnsavedDataWarning in our Flex app when the browser is about to unload //------------------------------------------------------- //window.onbeforeunload = function() window.onbeforeunload = onbeforeunload_handler; function onbeforeunload_handler() { var warning=""; var fxControl = document.${application} || window.${application}; if ( fxControl ) if ( typeof fxControl.getUnsavedDataWarning=="function") warning = fxControl.getUnsavedDataWarning(); // This calls a function in our Flex app if ( warning != '' ) return warning; else return void(0); } //------------------------------------------------------- // Specifies a function for the window's onunload event // Call back to the javascriptOnUnload in our Flex app when the browser unloads //------------------------------------------------------- window.onunload = function() { var fxControl = document.${application} || window.${application}; if ( fxControl ) if ( typeof fxControl.javascriptOnUnload=="function") fxControl.javascriptOnUnload(); // This calls a function in our Flex app } </script>private const UNSAVED_DATA_WARNING:String = 'You have unsaved changes. You will lose them if you continue.'; private function onCreationComplete():void { ExternalInterface.addCallback("getUnsavedDataWarning", function():String { return UNSAVED_DATA_WARNING; } ); }
我现在通过这个方法可以监听到ie关闭事件,但是我想禁止ie关闭应该要怎么做呢,现在这么写点确定还是会关闭ie
[解决办法]
这个好像控制不了呀,,直接关IE的关闭按钮去掉得了,
html里都可以设置IE的样式呀,,去掉边框,再自己模拟一个边框得了
[解决办法]
参考
http://topic.csdn.net/u/20090619/10/5725dbba-6376-4605-b318-8e009d987fbc.html?8083