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

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Rieko Saitoh
Posts: 40
Joined: Sat Apr 30, 2016 11:46 am

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

Post by Rieko Saitoh » Fri Jan 10, 2020 4:56 pm

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

Tim McEntee
Posts: 13
Joined: Thu May 26, 2016 8:46 am

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

Post by Tim McEntee » Fri Jan 24, 2020 11:35 am

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

Post Reply