Hi, I am using iframe to embed a qualtrics survey into my website, which works well. Now I want to show a button on my website only after users have finished the survey. I wonder whether it is possible for my website to detect the user has finished the survey.
Page 1 / 1
If you inspect the end of survey in Qualtrics, I think there is a class/id called "EndOfSurvey". However, the simplest way is to just customize your end of survey with an invisible div like:
Then you can detect this and trigger the required response.
Hi ahmedA, thank you for your quick reply. By saying "detect this", do you mean using "getElementByID"? I tried to use this function, but because of the Same-origin policy, chrome doesn't allow my page (parent) to visit the content within iframe (child).
Okay. the iframe issue.
You can probably post a message to the parent window. Something like:
parent.postMessage("End of Survey", "https://yourwebsite.com");
You can add an event listener to your JS:
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
if(event.data.includes("End of Survey")){
// You stuff here
}
}
See here and here for more details.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.