×

Loading...

Chrome browser's handling of <button> is weird!

In Chrome, if we do not put type=”button” in a <button> element, Chrome browser would trigger the window.onbeforeunload event handler for AJAX calls!

 

The workaround:

 

Always add the attribute of type=”button” in <button>.  Example:

 

<button class="doSomething" type="button">doSomething</button>

      

 

Sign in and Reply Report