Details
-
Bug
-
Resolution: Fixed
-
Normal
-
8.5.2
-
Security Level: Jimmy
-
IE 11
-
ZK 8.6.0 S1, ZK 8.6.0 S2, ZK 8.6.1 S1
Description
Steps to Reproduce
Run fiddle in IE11:
http://zkfiddle.org/sample/1qah9ee/2-ie11-iframe-onbeforeunload-download
trigger onBeforeunload by closing the current tab (or using ctrl+W)
click file download button
Current Result
file download triggers onBeforeUnload message ("Are you sure you want to quit")
Expected Result
file download should not trigger this message
Debug Info
In pure html, IE 11 triggers onBeforeUnload event on the main window if an Iframe in the page puts a request and receive a file response with content-header "content-disposition:attachment"
Can reproduce in pure html
Root Cause
IE11 wrongly triggers onBeforeUnload on main window when iframe content is changed
Workaround
- not perfect since if the server replies for longer than 1000ms, download will still trigger onBeforeUnload
- Page can be closed without warning for 1000ms after receiving the download instruction
<script><![CDATA[ zk.afterLoad('zul', function() { var x = {}; zk.override(zAu.cmd0, x ,{ download : function() { var sbu = zk.skipBfUnload; zk.skipBfUnload = true; var result = x.download.apply(this, arguments); setTimeout(function(){zk.skipBfUnload = sbu;},1000); return result; } });//zk.override });//zk.afterLoad ]]></script>