Page 1 of 1

VL- Web : How to avoid prompting when handling closing a browser.

Posted: Fri Jan 10, 2020 4:56 pm
by Rieko Saitoh
Hi,

Our customer would like to handle the closing of the browser and call the server module.
So, they are currently using the code below.

-----
Evtroutine Handling(#sys_web.CloseQuery) Querystring(#QueryString)
Define_Com Class(#ServerModule.SAVE) Name(#SAVE)
#SAVE.ExecuteAsync( #AAA )
#QueryString := "Closing the page will end the LANSA session"
Endroutine
-----

But, in this case, the message specified with "#QueryString" is displayed at the prompt.
If we do not set a value for #QueryString, this event will not be handled.
We don't want this prompt to appear.

Is there a way to handle closing the browser and not displaying prompt?

Best regards,
Rieko Saitoh
LANSA japan

Re: VL- Web : How to avoid prompting when handling closing a browser.

Posted: Fri Jan 24, 2020 11:35 am
by Tim McEntee
Hi Rieko Saitoh

Turns out that this is easy. I set the query string to blank and the prompt is not shown.

This is in Chrome. I didn't test in other browsers. The window.onbeforeunload feature that this hooks into is browser specific, so you may get different results with different browsers.

Evtroutine Handling(#sys_web.CloseQuery) Querystring(#QueryString)
Define_Com Class(#ServerModule.SAVE) Name(#SAVE)
#SAVE.ExecuteAsync( #AAA )
#QueryString := ""
Endroutine

Tim