Warning User / Visitor that changes not saved when leaving site.

I want to conditionally warn the user if they attempt to close the page-tab or the browser.

The wix editor does exactly this. Ie. If you make a change without saving and then click the ‘X’ to close the page-tab (in Chrome for example), A box is displayed saying: “Leave site? Changes you made may not be saved. [Leave] [Cancel]”. I want to be able to do pretty much the same from Corvid code.

I found the following forum article that suggests it’s not possible but I figure if the wix editor can do it, we should be able to do it too, right?? https://www.wix.com/corvid/forum/community-discussion/logging-off-users-automatically-when-they-close-the-browser-tab-or-window
There has been some follow-up forum discussion from the above entry with a solution to log users out if they leave by using the session data store to identify that the user has left the building. In my case this doesn’t work because I want to stop them leaving the building in the first place :wink:

Corvid is only a small part of a Wix site.

Wix uses different JavaScript components and is written on top of React.

Your data + Wix framework + million other things = a Wix site.

This means that if it is possible in the Editor - it does not mean that it is possible in Corvid as well (sadly) :slight_smile:

Currently the API doesn’t include functionality that lets you react when the user closes the tab or window, as it was stated in the forum post you are referring to.