Preventing participants from exiting fullscreen mode (JS code)

Hey everyone and thank you in advance for helping me out.

I am looking for a way to disable the option for the participants to exit fullscreen mode. I already disables the esc key in my experimental settings, but this only prevents one from exiting the experiment using esc, not from exiting fullscreen mode.
By preventing participants from exiting fullscreen I want to make sure that participants get less discrated. I am planning an online experiment, so I would need this to work in JS.

Many thanks!

I actually noticed myself that the most appropriate way is to simply log when somebody exits full screen and maybe terminate the experiment as a consequence.

1 Like

I think logging it is the best approach. The use of full-screen is tied in with browser security issues, so there’s no real way to prevent participants exiting it. You can imagine a malicious website that wanted to lock people into full-screen mode, and even fake being something other than a browser window… not good!

Some (but not all) browsers specifically inform the user how to exit full-screen when it’s entered, and even ask the user for permission before they do so. It can be useful to explicitly let them know this might happen and that’s it’s okay, etc.


Hi Matthew,
I fully agree. I noticed it myself and implemented a simple logging of full screen exit.
Thank you for your comment!

1 Like