ASP.NET, jQuery, dirty forms, and window.onbeforeunload
问题 In my ASP.NET web app, I'm trying to create a universal way of warning users before navigating away from a form when they've made changes, using jQuery. Pretty standard stuff, but after a lot of searching I have yet to find a technique that works. Here's what I have at this point: addToPostBack = function(func) { var old__doPostBack = __doPostBack; if (typeof __doPostBack != 'function') { __doPostBack = func; } else { __doPostBack = function() { old__doPostBack(); func(); } } } var isDirty =