Hello everyone!
Today I would like to share a tip that solved a problem I encountered when running my experiment on Pavlovia (if there’s a smarter way to solve this, please share!).
I have Psychopy version 2024.1.5 running on Windows 10 64-bit.
In short, my experiment features a questionnaire, followed by a a go/no-go task.
My questionnaire begins with an informed consent form that participants need to agree to in order to proceed. As an ethical requirement of my institution, participants must also be able to download a copy of the informed consent if they wish to do so.
Adding the link to download the copy wasn’t a problem (see here how to do it).
The problem was that, as a safety requirement that each (?) web browser implements, whenever a new tab is opened, it automatically leaves full screen mode to open the new tab. Given that the new tab is an automatic download link, it closes itself immediately, but when it goes back to the experiment page, it’s not in full screen anymore, and I need it to be for the go/no-go task.
One option would be to have participants re-enter full screen mode on their own, and I suppose it’s not too complicated from desktop (e.g., pressing F11 toggles full screen mode in Firefox). However, I couldn’t trigger that on my laptop, as my F11 button didn’t work. What if participants encounter the same problem?
The solution I came up with was to add a “Go Full Screen” button at the bottom of the informed consent page, so that if participants decide they want to download the informed consent, they can go back to full screen mode without any hassle.
Here is how I added it to my Pavlovia survey. I used this public survey to test the code.
- Open your Pavlovia survey on pavlovia.org;
- Click on “Design”;
- Click the text of the page you want to add the button to (in my case, the informed consent page);
- In the window on the right, under “General”, you should see a field called “HTML markup”, with the HTML code for your text page;
- Look for the section where you want the button to show up, in my case it’s after the download link. I also added a paragraph explicitly instructing participants to click on the button (better safe than sorry), for example like this:
<p>If you downloaded the informed consent file, click the button to go full screen again before proceeding. </p>
; - Right after the code in point 5, add this code chunk:
<button id="fullscreenBtn" onclick="document.documentElement.requestFullscreen();">Go Full Screen</button>
; - SAVE. Always save everything you ever do;
- OPTIONAL: download the .json file of your survey;
- Add the survey to your experiment in Builder. To do so, in the “Components” windows go to “Responses” and you should see “Pavlovia Survey”. Create a routine wherever you want your survey to be in, then select the .json file or link the survey id of the survey you want to use;
- Save and sync with pavlovia.org;
- Done!
Here is a screenshot to see how the link and button look like. Perhaps the more knowledgeable among us know how to make the button look aesthetically different.
It works on Firefox browser, hopefully it works on other browsers too.
That’s all! I hope it’s going to be useful to the community.
Cheers!