Note that there are some explanatory texts on larger screens.

plurals
  1. POonbeforeunload event cuase issue in IE8
    primarykey
    data
    text
    <p>I am using jquery in our application. We have some javascript code which validates if you modified any data. If user enter some values and click on some other link or something else then pop up comes which say "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page." Its working fine in IE7, IE9 and and firefox and other browser. But in IE8 it generates alert box which says "Stop running this script. The script on this page is causing your wb browser to run slowly If it continue to run , your computer might become unresponsive".</p> <p>Following is my javascript which cause problem.</p> <pre><code>$(document).ready(function() { // Flag to display warning. // If needToConfirm = true warning message will be displayed. needToConfirm = false; window.onbeforeunload = askConfirm; function askConfirm() { if (needToConfirm) { // Message to be displayed in Warning. return "Your data will be lost."; } } // Add all form elements in argument. $("select,input,textarea").live('change',function () { needToConfirm = true; }); // Add all form elements in argument. $("select,input,textarea").live('keypress',function () { needToConfirm = true; }); // Use "class = noWarning" for save or cancel button. $(".noWarning").click(function () { needToConfirm = false; }); }); </code></pre> <p>Is it problem of "window.onbeforeunload = askConfirm;" code some thing else.</p> <blockquote> <p>EDIT</p> </blockquote> <p>Found that following line cause problem in IE8</p> <pre><code>$("select,input,textarea").live('keypress',function () { needToConfirm = true; }); </code></pre> <p>Is it any other alternative for this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload