Web Application - CloseQuery Event

Fired when the browser navigates away from the WebPage

Member of Web Application (PRIM_WEB.Application)


NameTypeData TypeDescription
QueryString*BothStringText to be displayed in the prompt


The CloseQuery event is fired when the page is closing, prompting the user for confirmation before closing the window/tab running the application.
This feature uses the JavaScript beforeUnload event. Precise implementation will depend on the browser.
As of version 51, Chrome no longer allows user text to be displayed.
Both IE version 11 and Edge will show the text as entered.
FireFox will only show the prompt when navigating away from the page. The prompt is not shown if the browser is closed.


In this example, clicking the button will Close the page. The CloseQuery event will fire to ask for confirmation.
Begin_Com Role(*EXTENDS #PRIM_WEB)
   Evtroutine Handling(#sys_web.CloseQuery) Querystring(#QueryString)
      #QueryString := "Closing the page will end the LANSA session"

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020