Adding a Hyperlink That Opens Automatically After Study Ends

OS (e.g. Win10): Windows 11 Pro
PsychoPy version (e.g. 1.84.x): v2023.1.2
Standard Standalone? : Y
What are you trying to achieve? :

I am trying to add a hyperlink to the end of my study so that participants will finish the study and automatically be sent to a website where they can enter their email addresses for a prize draw.

Currently, I have my experiment set so that they do a word classification task and once they complete it they are shown a debrief page. The debrief is the last routine in the experiment and the debrief response is pressing the space bar. Since this is the last routine in the experiment, the debrief and in turn the entire experiment ends once they click the space bar.

What did you try to make it work?:

  1. I have tried to add a code component to the debrief routine that states:

import webbrowser"’)

on Auto → JS code (and I unclicked the “disabled” feature)

ISSUE 1: the “import webbrowser” part came up as a Syntax error
ISSUE 2: the “” was changed to “” in the second window of code

a. I added a “blank” routine after the debrief that simply displays “…” for 0.5 seconds
^ no response needed and when the 0.5 seconds ends, the experiment ends
b. I added a code component to this blank routine that stated:“”); #link to the website in brackets

on Auto → JS code (and I unclicked the “disabled” feature)

ISSUE: I ran the experiment on PsychoPy and Pavlovia with this code component and the experiment ended without opening the link to the website

How do I fix this?

Hi there,

Have you tried entering the URL in the “Completed URL” field as per the bottom of this page of the documentation?

If this doesn’t work/hasn’t worked already do let me know.



Hi Kim,

That worked perfectly! Thank you so much :slight_smile: