SHtml.a(() => JsCmd, NodeSeq, ElemAttr*) triggers unwanted behavior in IE
The following code:
Generates code without "return false;" as the last statement in the onclick-handler:
In my application i have a window.onbeforeunload handler which the above code triggers in IE due to the missing "return false;".
This example-code triggers the issue in IE:
After clicking the "bad"-link In IE, the above code will show a second alert showing "Fooka fooka" after showing "onbeforeunload WILL trigger".
".link" #> SHtml.a(() => Alert("hi"), Text("Click me))
Generates code without "return false;" as the last statement in the onclick-handler:
<a class="link" href="javascript://" onclick="liftAjax.lift_ajaxHandler("F237884313362YJQVOJ=true", null, null, null)">Click me</a>
In my application i have a window.onbeforeunload handler which the above code triggers in IE due to the missing "return false;".
This example-code triggers the issue in IE:
<html>
<head></head>
<body>
<script>window.onbeforeunload = function() {alert("Fooka fooka!");}</script>
<a href="javascript://" onclick="alert('onbeforeunload will NOT trigger'); return false;">good</a>
<a href="javascript://" onclick="alert('onbeforeunload WILL trigger');">bad</a>
</body>
</html>
After clicking the "bad"-link In IE, the above code will show a second alert showing "Fooka fooka" after showing "onbeforeunload WILL trigger".
Leave a comment