Skipping dialogue box prevents fullscreen

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
Hi fellow PsychoPy / JS enthusiasts,
my initial goal for my online experiment was to be able to skip the initial dialogue box. Usually it has 2 parameter (participant & a custom parameter). However, since my participants get forwarded from a survey tool, the parameters get passed using URL parameters. So, the dialogue box just has the progress bar and since I just have 4 excel files, it immediately shows all resources downloaded. So I searched for a way to automatically close the box, to avoid participants cancelling by mistake.

I found an answer this post from @Luke, and adjusted the code so that I have the following code in a JS-only code component in the Before Experiment-tab:

var checkOK = setInterval(function() { //Use basic nested setInterval for Status check of dialog
    console.log("Check if DialogBox loaded");
   if (document.getElementById("progressMsg")) { //Wait for ProgressMsg to exist
        console.log("Dialogbox exists."); //Dialog Box Ready
      var statusText = document.getElementById("progressMsg").innerHTML; //get Status of ProgressMsg
      if(statusText == "all resources downloaded.") //If status is good. Go and let JS Click the button
      {
      console.log("All resources were downloaded! Press Ok now...");
      document.getElementById("dialogOK").click(); // Click on the checkbox
      clearInterval(checkOK);
      }
   }
}, 500); // check every 500ms

So, my actual problem is, that I’ve set my experiment to full-screen mode. Without the code above and after syncing to pavlovia, everything is as expected: The dialogue box shows up, I click Ok and the experiment changes to full-screen. With the code snippet above the dialogue box gets closed as expected but the experiment doesn’t change into full-screen mode.

I know I am using a bit of a workaround to close the dialogue box, so my problem probably won’t be a common one. However, I would be very grateful, if somebody has a tip or even a solution.

What did you try to make it work?:
In addition I found this post which provided the following code snippet:

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

I tried to add it here:

    console.log("Check if DialogBox loaded");
   if (document.getElementById("progressMsg")) { //Wait for ProgressMsg to exist
        console.log("Dialogbox exists."); //Dialog Box Ready
      var statusText = document.getElementById("progressMsg").innerHTML; //get Status of ProgressMsg
      if(statusText == "all resources downloaded.") //If status is good. Go and let JS Click the button
      {
      console.log("All resources were downloaded! Press Ok now...");
      document.getElementById("dialogOK").click(); // Click on the checkbox
      psychoJS.window.fullscr = true;
      psychoJS.window.adjustScreenSize();
      clearInterval(checkOK);
      }
   }
}, 500); // check every 500ms

That didn’t work and when looking in the final .js script it’s clear, because I am accessing psychoJS before it was even initialized. So I thought, I put the two lines of code in the first routine that actually presents content to the participant: the welcomeScreen routine
I added a code component, put it at the top of that routine and added the following lines of code in the Begin routine-tab:

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

It still does not work.

What specifically went wrong when you tried that?:
The experiment isn’t changing to full-screen as expected.

I had this very recently and discovered that user input is needed before going full screen. See:

https://run.pavlovia.org/vespr/flowchart/