This function will be called whenever the user is trying to exit your page. But it's your job to accept or not to agreed his demand. So for your change, you should flag a var if changes have not been saved, and if it's true, then display a popup to ask what user wants to do.
check this link : http://help.dottoro.com/ljhtbtum.php Hope it'll help. Regards, Gregory collin. Le Sun, 21 Apr 2013 06:40:22 +0200, 杨华杰 <[email protected]> a écrit : > I think if I use this method, it will still alert the user even there > are no changes made by the user. > > > Regards, > Hua Jie > > > On Wed, Apr 17, 2013 at 5:47 PM, Grégory COLLIN > <[email protected]<mailto:[email protected]>> wrote: Le Wed, 17 Apr 2013 > 05:49:15 +0200, 杨华杰 <[email protected]<mailto:[email protected]>> a > écrit : > > > I want to alert my user if they close the window without save the > > changes. > > > > > > Is it possible to detect the changes? And how? > > > > Welcome any tips > > > > Regards, > > Hua Jie > > Hi Hua, > > You can use the javascript event beforeunload to alert your user. > I used mine, like this : > > $(window).bind('beforeunload',function(e){} > > Regards, > > Greg > _______________________________________________ > Users mailing list > [email protected]<mailto:[email protected]> > http://lists.osgeo.org/mailman/listinfo/openlayers-users > _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
