Re: [flexcoders] Re: warning on 'back' button before closing application?
Thanks, Jim. I don't think that'll work for us, but it's an interesting idea. I think one of the other problems is that by default, Firefox opens new windows in a new *tab*, thwarting the attempt to avoid the chrome. I think the onbeforeunload idea might work--we're actually already doing some other cleanup with that handler, so hopefully this should be straightforward. -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com -Original Message- From: jim.abbott45 Reply-To: flexcoders@yahoogroups.com To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: warning on 'back' button before closing application? Date: Wed, 14 Jan 2009 22:52:11 - Your other choice is to have your entire application opened in a new, separate browser window, but with the browser 'chrome' & history turned off. In that case, users cannot accidentally navigate away from the application, because there _is no_ navigation history to begin with. Of course not everyone likes the idea of opening new browser windows, so this technique may not be useful everywhere. Regards, Jim --- In flexcoders@yahoogroups.com, Maciek Sakrejda wrote: > > Is there a way to warn the user that they're about to navigate away from > the app through the browser's back button? This is actually a request > from our users: we don't use BrowserManager (I don't think it would even > make sense for us), but they are used to browser paradigms, and > sometimes hit 'back' inadvertently, navigating away from the > application. Is there a way to issue a warning beforehand? > > -- > Maciek Sakrejda > Truviso, Inc. > http://www.truviso.com >
[flexcoders] Re: warning on 'back' button before closing application?
Your other choice is to have your entire application opened in a new, separate browser window, but with the browser 'chrome' & history turned off. In that case, users cannot accidentally navigate away from the application, because there _is no_ navigation history to begin with. Of course not everyone likes the idea of opening new browser windows, so this technique may not be useful everywhere. Regards, Jim --- In flexcoders@yahoogroups.com, Maciek Sakrejda wrote: > > Is there a way to warn the user that they're about to navigate away from > the app through the browser's back button? This is actually a request > from our users: we don't use BrowserManager (I don't think it would even > make sense for us), but they are used to browser paradigms, and > sometimes hit 'back' inadvertently, navigating away from the > application. Is there a way to issue a warning beforehand? > > -- > Maciek Sakrejda > Truviso, Inc. > http://www.truviso.com >
[flexcoders] Re: warning on 'back' button before closing application?
Yes it is possible but you need some JavaScript You can create a js include file or put this in your wrapper template file. The idea is to put a event listener on the onbeforeunload function. I have tested this in a few more common browsers and it works. window.onbeforeunload = warnOfUnsavedChanges; function warnOfUnsavedChanges(){ //You can add a boolean to be set using externalInterface IF the form/data is dirty in Flex return 'You have unsaved changes on this page, which will be discarded if you leave now. Click Cancel in order to save them first.'; } Simple string return from the onbeforeunload method does the trick. I would also like to get this working from inside Flex to use the externalInterface to inject the needed JS but I did not have luck yet with this. --- In flexcoders@yahoogroups.com, Maciek Sakrejda wrote: > > Is there a way to warn the user that they're about to navigate away from > the app through the browser's back button? This is actually a request > from our users: we don't use BrowserManager (I don't think it would even > make sense for us), but they are used to browser paradigms, and > sometimes hit 'back' inadvertently, navigating away from the > application. Is there a way to issue a warning beforehand? > > -- > Maciek Sakrejda > Truviso, Inc. > http://www.truviso.com >