In order to prevent that participants take too long for my experiment on the last page, I want them to redirect to a URL (Prolific completion url) on a specified automatic time-out of the page.
I tried it with jQuery and the finish.countdown function. I have this code:
Pages:
timeout_seconds = 35
timer_text = 'Unless you continue, page will auto-submit in:'
Javascript:
<script>
$(function () {
$('.otree-timer__time-left').on('update.countdown', function (event) {
if (event.offset.totalSeconds === 20) {
$('.otree-timer').show();
}
});
});
$(function () {
$('.otree-timer__time-left').on('finish.countdown', function () {
});
});
</script>
<style>
.otree-timer {
display: none;
}
</style>
Somehow, it is not working and I cannot find the problem. It only shows "No more pages left." and does not redirect. What would also work for me would be to make a button be submitted on timeout.