Yes, I just found it there and it works now with the code below. Also works if you add a code component and enter the code in the End Experiment tab. Participants are now automatically redirected to Prolific with the completion URL and all data is saved
Thanks, @wakecarter for your support! The tip about the code for the starting dialog box helped me a lot!
var checkOK = setInterval(function() {
// Wait for the element containing "Thank you for your patience" to exist
var thankYouElement = document.querySelector(".scrollable-container");
if (thankYouElement) {
console.log("Thank you element found.", thankYouElement.innerText);
// If the text includes "Thank you for your patience," click the OK button
if (thankYouElement.innerText.includes("Thank you for your patience")) {
// Get the status of the OK button
var statusOK = document.getElementById("dialogOK").innerHTML;
console.log("Press Ok now...", statusOK);
// Click on the OK button if it's enabled
var okButton = document.getElementById("dialogOK");
if (okButton && !okButton.disabled) {
console.log("Clicking OK button...");
okButton.click();
} else {
console.log("OK button is not enabled.");
}
// Stop the interval
clearInterval(checkOK);
}
}
}, 100); // Check every 100ms