Making experiment full-screen part way through

Hi there,

I have an online experiment with a series of Pavlovia surveys at the start. These surveys need the experiment to NOT be in full-screen mode. After the surveys I have a task which I would like to be in full-screen mode. Is there any way of initiating the full-screen window at the start of the task (i.e., halfway through the experiment)? For example, some javascript code I can add to force the window into full-screen using a custom code component?

Thanks in advance for your help.

The code you want is:

psychoJS.window.fullscr = true;
psychoJS.window.adjustScreenSize();

Unfortunately this code does not seem to work :frowning:

My online experiment has an embedded survey with a participant information sheet, which participants can download if they want to (ethical requirement of my institution). If participants do download this information sheet, it opens a new tab, which in turn means the browser automatically leaves full screen mode.

When however the participants return to the “main” experiment after the survey, I need the experiment to automatically go back to full screen, and had hoped the code above (added to the start of the next routine) would work, but alas…..

I suppose if all else fails, I can do this: Tip - Add a “Go Full Screen” button to your Pavlovia online survey/experiment - Online experiments / Pavlovia Surveys - PsychoPy, but I would prefer to “force” this by code.

Is there any other code I could try? Thanks in advance for your help.

OK, I figured it out - this code only works after there has been user interaction after return to the “main experiment” - so I added a “please press space bar to continue” routine after the survey routine, where I added this code to run at the end of the routine.

For those curious, the linked solution by @amazza also works like a treat, so decided to do both and thus have the code as safety net for those participants that forget to press the button.