| Reference | Downloads | Github

How reliable is psychoJS.window._windowAlreadyInFullScreen

I want my experiment to end if the participant exits the fullscreen mode. I’m planning to use something like this code at the end or beginning of every routine:

if not win._windowAlreadyInFullScreen:
    # full screen exited, end experiment.
    quitPsychoJS("The experiment is over.", false);

However, I read this in the core Window source code (

		// (!window.screenTop && !window.screenY) does not work in all browsers on all operating systems (e.g. Chrome on
		// Windows). As far as I can ascertain, as of 2019.08.01 there still does not seem to be a reliable way to
		// test whether the window is already fullscreen.
		// this._windowAlreadyInFullScreen = (!window.screenTop && !window.screenY);

Is it any change as to whether is possible to realiable tell if the web browser window is full screen or not?

You could monitor the keyboard for the Escape key Each Frame. Then a single key press would exit full screen and then immediately exit the experiment.