Custom background code inconsistent on Safari | XM Community
Skip to main content

Hello,

I’m designing a study where I assign a random value from 1 to 11 to each participant, and that value will define what background they see for their study (for some of the blocks). I have piloted this in many browsers (Chrome, Opera, Edge, Mozilla) many times and everything is working fine, but in Safari I sometimes cannot see a background on the first question that participants see -- it only appears in the second question that they see. Sometimes the background also disappears on a question later on in the survey and comes back. The only consistency is that when I do have the issue of the background disappearing, it is always for the first question of a block. The order of the blocks (and therefore of the first question participants see) is randomized and each block has custom Javascript of the following form in the first question:

Qualtrics.SurveyEngine.addOnload(function()
{
    /*Place your JavaScript here to run when the page loads*/
    if ("${e://Field/Room}" == "1") {
        document.body.style.backgroundImage = "url('linkhere')";
    };
    
    if ("${e://Field/Room}" == "2") {
        document.body.style.backgroundImage = "url('linkhere')";
    };
    
 //etc

});

It is very hard to debug since the issue is appearing with Safari and is not systematic. Does anyone have any idea why that might be occurring? Do I need to exclude anyone using Safari from my sample pool or is there an alternative?

Be the first to reply!

Leave a Reply