Opening two links at the end of the experiment

Pavlovia Link: Pavlovia

Hello, I would like participants to do two things at the end of the experiment.

  1. Visit a website
  2. Be redirected to another website (SONA) to collect the credit.

The order does not matter. Website 1 does not allow me redirect to SONA. My approach is to simply open a new web-browser tab for website 1 and use this code for that:

let newTab = window.open();
newTab.location.href = “https://www.google.com”;

and for the completion URL, use the SONA website. While this works when running is locally, on Pavlovia I’m getting this error: TypeError: Cannot read properties of null (reading ‘location’).

Any help is appreciated!