Thank you for that. Pressing ‘escape’ twice is something that participants would never do, so I think it is a poor trigger for the incomplete URL to be honest.
For the sake of completeness, I am posting my solution for how to define the URLs here as the solution from your crib sheet did not work for me @wakecarter. I am using a code component to run at the beginning of the experiment. Otherwise, giving several information to the link did not work for me. Hence I created it as a string as a code component and defined the links manually.
myCompletedURL = `https://bangorhumanscience.fra1.qualtrics.com/jfe/form/xyz?Prolific_PID=${expInfo["id"]}&ComboIndex=${expInfo["ComboIndex"]}`;
myCancelledURL = `https://bangorhumanscience.fra1.qualtrics.com/jfe/form/xyz?Prolific_PID=${expInfo["id"]}`;
psychoJS.setRedirectUrls(myCompletedURL, myCancelledURL)
Am I right in thinking that there is no way using PsychoJS to disable the exit from the full screen upon pressing escape?
The only way then to give participants an early out with a re-direct then is to tell them to press a specific key, e.g. ‘q’ to exit which I got working with the snippet below. Am I right in thinking that this would need to be checked every frame in an experiment?
if (psychoJS.eventManager.getKeys({keyList:['q']}).length > 0) {
message = "You ended the experiment early. Please press 'OK' to close the session."
quitPsychoJS(message, false);
}
but doing the same with escape no matter whether escape is enabled or disabled in the builder settings does not work.
What I have figured out just now is to disable the escape key, and check in every frame of a given routine whether we are still in full screen mode or not. If not, then it will assume that the participant is leaving and it will re-direct to the incomplete URL Happy days!
if (document.fullscreenElement === null) {
message = "You ended the experiment early. Please press 'OK' to close the session."
quitPsychoJS(message, false);
}