Redirect to a new website | XM Community
Skip to main content
Solved

Redirect to a new website

  • January 6, 2024
  • 7 replies
  • 505 views

jmborzick
QPN Level 5 ●●●●●
Forum|alt.badge.img+41
  • QPN Level 5 ●●●●●
  • 261 replies

At the end of the survey, I want to my survey to redirect my user to a new website but I want that site to open in a new tab. Ideally, I would do this through the redirect in an end of survey block, but if there is a way to do it in an end of survey message, that would work too.

However, if I use the end of survey message, I want the link to automatically redirect them after a few seconds; I don’t want the user to have to click the link. 

 

Thoughts? 

Best answer by Shashi

Another way is to use below script in end of survey message:

<script>
setTimeout(function(){ window.open('https://community.qualtrics.com/', '_blank'); }, 5000);
</script>End of survey message goes here.

 

7 replies

Forum|alt.badge.img+21
  • QPN Level 5 ●●●●●
  • 306 replies
  • January 7, 2024

Hi @jmborzick There is a workaround which is very close to your use case.


STEP 1: You can create a text/graphic question saying ‘Thank you for filling out the survey, you will  now be redirected to our website.’ or anything as per your need and add JS to it which will auto advance after 5 seconds to the ‘End of Survey’ message and will also hide the next button. Below is the code.
 


Qualtrics.SurveyEngine.addOnload(function(){
 // Hide back button on this specific page 
this.hideNextButton();
 });

Qualtrics.SurveyEngine.addOnReady(function() {
    /*Place your JavaScript here to run when the page is fully displayed*/
    var qid = this.questionId;

    // Use setTimeout to wait for 5 seconds and then click the Next button
    setTimeout(function() {
        jQuery('#NextButton').click();
    }, 5000);
});

STEP 2: Select ‘End of Survey’ message options and add your desired URL.

 

This should work.


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 552 replies
  • January 7, 2024

 

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • 654 replies
  • Answer
  • January 7, 2024

Another way is to use below script in end of survey message:

<script>
setTimeout(function(){ window.open('https://community.qualtrics.com/', '_blank'); }, 5000);
</script>End of survey message goes here.

 


jmborzick
QPN Level 5 ●●●●●
Forum|alt.badge.img+41
  • Author
  • QPN Level 5 ●●●●●
  • 261 replies
  • January 8, 2024

@Shashi Thank you! This works perfectly, except, when instead of opening up the redirect link into just one new tab, it opens it up into two tabs. Do you have any idea why that might be happening?


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 552 replies
  • January 8, 2024

For some reason my previous post is blank but it’s linked to a point I was addressing in it. You’re probably seeing 2 tabs because you’re previewing with both the desktop and the mobile views enabled.

Be aware that this solution will be blocked by most browsers’ default popup settings.


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • 654 replies
  • January 8, 2024

@Shashi Thank you! This works perfectly, except, when instead of opening up the redirect link into just one new tab, it opens it up into two tabs. Do you have any idea why that might be happening?

 Please test it using annonymous link which should open only one tab. Also as rightly said by

@vgayraud  - new tab open will be blocked by most browser. We can use below script to open in same tab if opening in same tab works for the use case:

<script>
setTimeout(function(){ location.href = 'https://community.qualtrics.com/';}, 5000);
</script>End of survey message goes here.

 


jmborzick
QPN Level 5 ●●●●●
Forum|alt.badge.img+41
  • Author
  • QPN Level 5 ●●●●●
  • 261 replies
  • January 8, 2024

@Shashi & @vgayraud Thank you both for your assistance. Testing it outside of preview fixed the double opening. Regarding the new tab, thanks for the heads up. I was able to solve the issue by opening in _Parent instead. The problem was I was creating a website intercept and didn’t want the redirect website opening in the small intercept window.