This sounds like a no-brainer, so sorry, but I’m struggling.
I need my web app to do something specific when it shuts down.
The only way I can debug this is doing a remote debugging session to the target machine. But in this mode, if I quit the terminal that it opens or stop it from the Xojo IDE, it just kills the app. The closed event never fires and no destructor code is fired.
This is the example being suggested by James & Greg. A WebButton that calls App.Quit when pressed, but that won’t be shown if the app is not running in Debug mode (just in case):