Redirecting to different external URLs based on groupid value


Author
Message
egcunningham
egcunningham
New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)
Group: Forum Members
Posts: 2, Visits: 8
Hi there,

I am looking for some help with an issue I am encountering after trying to follow the instructions from an older version forum post (https://forums.millisecond.com/RssFeed2.aspx?TopicID=19623). I have followed exactly the steps provided in one of the responses there and have the following code:
https://mili2nd.co/MYTASK?ParticipantID=test&Group=85
https://mili2nd.co/MYTASK?ParticipantID=test&Group=86
https://mili2nd.co/MYTASK?ParticipantID=test&Group=87
https://mili2nd.co/MYTASK?ParticipantID=test&Group=88

<expt>
/ onexptbegin = [
  if (script.groupid == 85) {defaults.finishpage = "http://www.example.com";}
  else if (script.groupid == 86) {defaults.finishpage = "http://www.google.com";}
  else if (script.groupid == 87) {defaults.finishpage = "http://www.yahoo.com";}
  else if (script.groupid == 88) {defaults.finishpage = "http://www.bing.com";}
]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your group id is <%script.groupid%>.~nYou'll be redirected to <%defaults.finishpage%>.")
/ size = (75%, 50%)
</text>


This code results in the proper information being displayed on the screen (see screenshot below), however, when the spacebar is pressed, the original default finish page is displayed rather than the URL set to defaults.finishpage and shown on the screen. I cannot figure out how to get the URL to actually be opened in a browser window to redirect the participant from Inquisit. Any help would be greatly appreciated! I am new to using this software!

 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 109K
egcunningham - 1/8/2026
Hi there,

I am looking for some help with an issue I am encountering after trying to follow the instructions from an older version forum post (https://forums.millisecond.com/RssFeed2.aspx?TopicID=19623). I have followed exactly the steps provided in one of the responses there and have the following code:
https://mili2nd.co/MYTASK?ParticipantID=test&Group=85
https://mili2nd.co/MYTASK?ParticipantID=test&Group=86
https://mili2nd.co/MYTASK?ParticipantID=test&Group=87
https://mili2nd.co/MYTASK?ParticipantID=test&Group=88

<expt>
/ onexptbegin = [
  if (script.groupid == 85) {defaults.finishpage = "http://www.example.com";}
  else if (script.groupid == 86) {defaults.finishpage = "http://www.google.com";}
  else if (script.groupid == 87) {defaults.finishpage = "http://www.yahoo.com";}
  else if (script.groupid == 88) {defaults.finishpage = "http://www.bing.com";}
]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your group id is <%script.groupid%>.~nYou'll be redirected to <%defaults.finishpage%>.")
/ size = (75%, 50%)
</text>


This code results in the proper information being displayed on the screen (see screenshot below), however, when the spacebar is pressed, the original default finish page is displayed rather than the URL set to defaults.finishpage and shown on the screen. I cannot figure out how to get the URL to actually be opened in a browser window to redirect the participant from Inquisit. Any help would be greatly appreciated! I am new to using this software!

 

You didn't provide a link to the actual web experiment, so it's impossible to know what you have configured. Note two things:
(1) If you are usng a batch script, then the finish page ought to be set in the batch script. What you do in a task script administered by the batch has no effect.
(2) In the web settings, the default finish page option must be selected. If you select anything else there, it will override whatever you set in script.
egcunningham
egcunningham
New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)New Member (6 reputation)
Group: Forum Members
Posts: 2, Visits: 8
Dave - 1/8/2026
egcunningham - 1/8/2026
Hi there,

I am looking for some help with an issue I am encountering after trying to follow the instructions from an older version forum post (https://forums.millisecond.com/RssFeed2.aspx?TopicID=19623). I have followed exactly the steps provided in one of the responses there and have the following code:
https://mili2nd.co/MYTASK?ParticipantID=test&Group=85
https://mili2nd.co/MYTASK?ParticipantID=test&Group=86
https://mili2nd.co/MYTASK?ParticipantID=test&Group=87
https://mili2nd.co/MYTASK?ParticipantID=test&Group=88

<expt>
/ onexptbegin = [
  if (script.groupid == 85) {defaults.finishpage = "http://www.example.com";}
  else if (script.groupid == 86) {defaults.finishpage = "http://www.google.com";}
  else if (script.groupid == 87) {defaults.finishpage = "http://www.yahoo.com";}
  else if (script.groupid == 88) {defaults.finishpage = "http://www.bing.com";}
]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your group id is <%script.groupid%>.~nYou'll be redirected to <%defaults.finishpage%>.")
/ size = (75%, 50%)
</text>


This code results in the proper information being displayed on the screen (see screenshot below), however, when the spacebar is pressed, the original default finish page is displayed rather than the URL set to defaults.finishpage and shown on the screen. I cannot figure out how to get the URL to actually be opened in a browser window to redirect the participant from Inquisit. Any help would be greatly appreciated! I am new to using this software!

 

You didn't provide a link to the actual web experiment, so it's impossible to know what you have configured. Note two things:
(1) If you are usng a batch script, then the finish page ought to be set in the batch script. What you do in a task script administered by the batch has no effect.
(2) In the web settings, the default finish page option must be selected. If you select anything else there, it will override whatever you set in script.

Hi Dave,

Thank you so much for your questions. My apologies for not providing more details about where this script was in my pipeline. I have created a dummy link for testing here: https://mili2nd.co/dhrb?ParticipantID=test&Group=3. It produces the behavior I am having issue with. 

Here are the answers to your questions:

1) The script chunk I provided in my original post was from a separate script that I call after the end of the tasks in the batch script in each relevant batch. See below where testing_urlpiping.iqx contains the code I included in the previous post (I changed the groupIDs because I am using a dummy script for troubleshooting). Is this code incorrect? Do I need to somehow specify the browser I want to open?  


<batch Task1>
/ groups = (1 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task2>
/ groups = (2 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task3>
/ groups = (3 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task4>
/ groups = (4 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>


2) I have the default finish page set in the web settings as you can see from the final page that is brought up after the experiment ends. 

Thank you again for any suggestions you can provide me! I appreciate it!
- Emma
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 109K
egcunningham - 1/8/2026
Dave - 1/8/2026
egcunningham - 1/8/2026
Hi there,

I am looking for some help with an issue I am encountering after trying to follow the instructions from an older version forum post (https://forums.millisecond.com/RssFeed2.aspx?TopicID=19623). I have followed exactly the steps provided in one of the responses there and have the following code:
https://mili2nd.co/MYTASK?ParticipantID=test&Group=85
https://mili2nd.co/MYTASK?ParticipantID=test&Group=86
https://mili2nd.co/MYTASK?ParticipantID=test&Group=87
https://mili2nd.co/MYTASK?ParticipantID=test&Group=88

<expt>
/ onexptbegin = [
  if (script.groupid == 85) {defaults.finishpage = "http://www.example.com";}
  else if (script.groupid == 86) {defaults.finishpage = "http://www.google.com";}
  else if (script.groupid == 87) {defaults.finishpage = "http://www.yahoo.com";}
  else if (script.groupid == 88) {defaults.finishpage = "http://www.bing.com";}
]
/ blocks = [1=myblock]
</expt>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("Your group id is <%script.groupid%>.~nYou'll be redirected to <%defaults.finishpage%>.")
/ size = (75%, 50%)
</text>


This code results in the proper information being displayed on the screen (see screenshot below), however, when the spacebar is pressed, the original default finish page is displayed rather than the URL set to defaults.finishpage and shown on the screen. I cannot figure out how to get the URL to actually be opened in a browser window to redirect the participant from Inquisit. Any help would be greatly appreciated! I am new to using this software!

 

You didn't provide a link to the actual web experiment, so it's impossible to know what you have configured. Note two things:
(1) If you are usng a batch script, then the finish page ought to be set in the batch script. What you do in a task script administered by the batch has no effect.
(2) In the web settings, the default finish page option must be selected. If you select anything else there, it will override whatever you set in script.

Hi Dave,

Thank you so much for your questions. My apologies for not providing more details about where this script was in my pipeline. I have created a dummy link for testing here: https://mili2nd.co/dhrb?ParticipantID=test&Group=3. It produces the behavior I am having issue with. 

Here are the answers to your questions:

1) The script chunk I provided in my original post was from a separate script that I call after the end of the tasks in the batch script in each relevant batch. See below where testing_urlpiping.iqx contains the code I included in the previous post (I changed the groupIDs because I am using a dummy script for troubleshooting). Is this code incorrect? Do I need to somehow specify the browser I want to open?  


<batch Task1>
/ groups = (1 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task2>
/ groups = (2 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task3>
/ groups = (3 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>

<batch Task4>
/ groups = (4 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ file = "testing_urlpiping.iqx"
</batch>


2) I have the default finish page set in the web settings as you can see from the final page that is brought up after the experiment ends. 

Thank you again for any suggestions you can provide me! I appreciate it!
- Emma

As I said, you cannot have a task script run by a batch set the finish URL. You need to set the URL in the respective batch script and <batch> element. That's the issue.

<batch Task1>
/ groups = (1 of 4)
/ file = "rcane_corsiblocktapping_forward_new.iqx"
/ onscriptend = [
    if (script.groupid == 85) {
        defaults.finishpage = "http://www.example.com";
    } else if (script.groupid == 86) {
        defaults.finishpage = "http://www.google.com";
    } else if (script.groupid == 87) {
        defaults.finishpage = "http://www.yahoo.com";
    } else if (script.groupid == 88) {
        defaults.finishpage = "http://www.bing.com";
    }
]
</batch>

...



and so forth is what you need to do.
Edited 2 Weeks Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search