Pop-up when participants close the survey window before completion? | XM Community
Skip to main content

Hello,
I'm putting together a survey and there are two related features that I'd like to be able to implement. I've scoured Google and the community boards and haven't been to find the help I need, so I've decided to ask here:

  1. To prevent accidental closures, is there a way to have a pop-up message activate when a participant exits the window on an incomplete survey confirming that they would like to leave the survey?

  2. I'm also interested in collecting data about why participants might be leaving the survey incomplete, so is there a way that the pop-up message could be used to ask a single multiple choice or open-text question?

If anyone has any clues for implementing either or both of these features, it would be much appreciated!

Kam86
Try including the below in html of question.


https://community.qualtrics.com/XMcommunity/discussion/comment/50600#Comment_50600Deepak
Thank you. This script addresses my first goal (preventing accidental closures) perfectly. Placing it in the HTML section of any question creates a pop-up asking participants to confirm they want to leave the page across the whole survey.
After a bit of research, however, it looks like the second goal (embedding a question within this pop-up) may not be possible. As far as I can tell, modern browsers do not allow the default pop-up to be modified with an original message/question.
Of course, I would love for someone to prove me wrong or find a different workaround within Qualtrics!


Kam86
Yes, you are correct you cannot modify/alter/check which option is selected. Hence, you wouldn't be able to capture the reason on before unload of window. An ideal approach here would be to check if the person has clicked leave and from that point redirect them to a survey and give the feedback as to why they left the partial response.
Following pages might be of your interest if you would want to explore:

  1. Window prompt() Method (w3schools.com)

  2. javascript - Check which button clicked on page leave prompt? - Stack Overflow

  3. javascript - Can I "redirect" user in onbeforeunload? If can't, how to? - Stack Overflow

These used to work on old browsers, in new browsers due to security and malicious activities protection. All of these modifications are disabled.
If the answer helps you kindly accept it!


https://community.qualtrics.com/XMcommunity/discussion/comment/50651#Comment_50651Sorry if this is a totally stupid question, but I'm not a coder at all so forgive me in advance Deepak :)

On one of the pages you link to, there is a mention to showcase a link asking if they want to go to Google instead. The code snippet is like this:
window.onbeforeunload = function(){
window.open("http://www.google.com","newwindow");
return "go to google instead?";
}
Since I dont even know where to place the above, I wanted to ask if it perhaps would be possible to instead of a Google link use a link to a hidden question within the survey?

Just trying to brainstorm in fields I know nothing about, haha!
All the best
-Mattias


https://community.qualtrics.com/XMcommunity/discussion/comment/50653#Comment_50653MattiasM Yes, this was available in previous version of browsers like i had mentioned. Currently in modern browsers this functionality is disabled.


Leave a Reply