Disabling the "Leave site?" warnings for seamless daisy-chain

Hi, my study involves daisy chaining the following:
Consent Forms (Pavlovia Survey) → Pavlovia Experiment → Questionnaire (Pavlovia Survey) → Debrief Sheet (Pavlovia Survey)

When redirecting a Pavlovia Survey to a Pavlovia Experiment etc., a warning shows up that says, “Leave Site? Changes that you made may not be saved.”

Is there anything I can do to disable such warnings?

I’ve tried to insert a line of jQuery into my jsPsych code based on this Superuser post but it didn’t work.

I thought others may run into similar problems, as one of the common use cases for Pavlovia Surveys could be to create Participant Information Sheets or Consent Forms that then gets redirected to Pavlovia Experiments.

You don’t get this issue if you define the completed URL in the survey overview page, not within the survey.

1 Like

Thanks!

On a related note, I assume that seeing the yellow Warning “Terminating the experiment. Please wait a few moments.” is normal, and there would be no workaround to hide this one?

For anyone else who might want to disable the “Leave site” warning for the Experiment → Survey daisy-chain, I managed with the following:

window.addEventListener('beforeunload', function (event) {
  event.stopImmediatePropagation();
});

That yellow warning is the period that the data is being saved, so it (or equivalent) needs to be there.

1 Like