Open link in separate tab | XM Community
Skip to main content

Hi all,
I have a 2 fold question. I am working on a survey, which is displayed as part of an intercept. At some point one of the survey has a multiple choice question asking what would the respondent like to do next. 1. Take a survey or 2. Speak to an agent. If opt 2 is selected I have display logic that displays a text question with a piece of text saying "please wait while we redirect you". What is meant to happen next is that after this question the person is taken to end of survey. As part of the question I have included a piece JS code (code below) that will open the website contact us page in a separate tab. It is a requirement that the contact us page opens in a separate tab/window.
This is all working... for a while... without any known trigger, It "seems" that the survey gets corrupted and the all process fails when the recipient selects the opt2 and click next, which should trigger the process I explained above. Mainly it seems that the JS code, which allows to open the hyperlink in a new page is failing.
Question 1: When I try to troubleshoot, I see that in preview the JS is not working and the hyperlink is opening on the same window. Funny enough if I make a copy of the survey or export/import the survey, it works all well...Why a copy of a survey behave different after an import/export?
Question 2: Is there a better way to achieve what I am trying to do with the JS without using custom code?


Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
function NewTab() { 
      window.open( 
              "http://www.website/contact-us/", "_blank"); 
    }
NewTab();

});

I think it is only an issue in Preview because you aren't in the top window.


https://www.qualtrics.com/community/discussion/comment/26336#Comment_26336Thanks Tom.
Unfortunately it happens when the survey is published and being taken in production environment.
Have you ever came across w/ the possibility of the survey component being corrupted? e.g. a survey that already took on so many changes, reviews, edit that at some point corrupted the core file? If yes, is there a way to troubleshoot something like this to try understand root cause?


Have you ever came across w/ the possibility of the survey component being corrupted? e.g. a survey that already took on so many changes, reviews, edit that at some point corrupted the core file? If yes, is there a way to troubleshoot something like this to try understand root cause?

Yes, I have had this happen to me on at least one occasion. If I remember correctly, in my case I had an earlier copy of the survey, so I made new copy of that and updated.


Good. I had to manually recreate the survey and this now seems to be working. But because I dont know what the trigger is that causes the problem, I just have to sit and wait to see if it happens again.
I am trying to speak to Qsupport to see if there is any other way that they can actually see what happened in the background.


Leave a Reply