Does it "OnDestroy" on closing the browser?

Hi,

We want to call an action e.g. to clear session (customized) on the OnDestroy event. Just wondering if it triggers on closing the browser.

Regards,

JC

When you close your browser, the session should also end (so long as you don't have another window open), regardless if your OnDestroy event gets triggered or not.

You can use the OnDestroy event of the BottomBar block. But, can you give us more details about your scenario case?

Basically we don't have a login and just use Session Tokens when the user accesses a specific transaction. The screens are anonymous. When the user accesses the transaction in a proper way, a token is created and is stored in the database with reference to that transaction id. On 'logout', there is a process that basically deletes this record so that it will invalidate the 'session'.

I am already calling this 'logout' process on the OnDestroy event of a screen. Now just wondering if this triggers when you close the browser.

Yes, when you close the browser, will be trigger the OnDestroy, and clean DOM.

Nuno Miguel Verdasca wrote:

Yes, when you close the browser, will be trigger the OnDestroy, and clean DOM.

Although now we tried a pure JS approach, still had to try this one out. Unfortunately, didn't work. Created a screen action OnDestroy for a screen and just call a CreateEntity for a record. Moving out of that screen created a new record. Closing the browser didn't.