Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Unload event |
Fri, Aug 14 2015 6:39 AM | Permanent Link |
squiffy Telemix Ltd. | Is it possible to fire an event before a closed browser tab removes the application? I appreciate it might be unreliable and it's not critical, just desirable if possible.
|
Fri, Aug 14 2015 10:52 AM | Permanent Link |
Rick | squiffy wrote:
>>Is it possible to fire an event before a closed browser tab removes the application? I appreciate it might be unreliable and it's not critical, just desirable if possible.<< You could try the following ... unit Unit1; interface uses WebCore, WebUI, WebForms, WebCtrls, WebDOM; type TForm1 = class(TDialog) procedure Form1Create(Sender: TObject); private { Private declarations } public { Public declarations } function unload(event: TEvent): string; end; var Form1: TForm1; implementation procedure TForm1.Form1Create(Sender: TObject); begin setwindoweventhandler(window,'beforeunload',unload); end; function TForm1.unload(event: TEvent): string; begin window.alert('here'); Result:='some text'; end; end. Best to use the onbeforeunload event rather than onunload because more of the EWB environment is probably available. When running from the IDE the alert and the leaving page prompt work correctly. When running from a browser (Firefox, IE) window.alert gives an exception (viewable via developer tools) and the result text which should force the prompt is ignored. Don't know why. Maybe the EWB environment is already unstable at this point so don't know how much you will be able to do within the event. -- Rick |
Sat, Aug 15 2015 12:23 PM | Permanent Link |
squiffy Telemix Ltd. | Thanks, I'll give it a go.
|
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |