Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2422

<a> component causes onbeforeUnload in IE<=10

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 7.0.4
    • 7.0.2
    • Components
    • Security Level: Jimmy
    • None
    • IE 10 or below

      To reproduce the issue run the page below and click the first link "reproduce problem". the beforeUnload listener is called even though the page is not unloaded.
      (Can also be reproduced in IE11 with IE10 emulation)

      <zk>
      	<window id="mainWin" width="100%" height="100%" >
      		<script type="text/javascript"><![CDATA[
      			zk.afterMount(function () {
      				zk.beforeUnload(function() {
      					console.log("invoke beforeUnload")
      		 		})
      			});
      		]]></script>
      
      		<vlayout>
      			Click the links/button and check the JS console, the first link causes an onBeforeUnload event in the browser window when using IE10 or below
                              (caused/not prevented by href="javascript:;" on the &lt;a&gt; component)
      			<a label="reproduce problem" onClick='Clients.showNotification("response from server 1")'></a>
      			<a label="workaround using href = #" onClick='Clients.showNotification("response from server 2")' href="#"></a>
      			<label value="workaround using label" onClick='Clients.showNotification("response from server 3")' style="cursor: pointer; text-decoration: underline; color: blue;"/>
      			<button label="workaround using button" onClick='Clients.showNotification("response from server 4")'/>
      		</vlayout>
      	</window>
      </zk>
      

      The code example shows 3 workarounds using an onClick event that does not cause the problem.

            hanhsu hanhsu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: