title: Qualtrics.SurveyEngine.addOnload runs twice in preview mode in Qualtrics survey software
body: <p>Whenever I try to test a Qualtrics survey in preview mode, Qualtrics.SurveyEngine.addOnload  will be called twice. This is not a problem for conditional events (as in most of the examples), but a large problem for unconditional code a timed page change (this will be triggered twice as well). See the following snippet:</p>
  
  <pre><code>Qualtrics.SurveyEngine.addOnload(function()
  {
       $('NextButton') &amp;&amp; $('NextButton').hide();
       var that = this;
       var timeOutInterval=1000+Math.trunc(Math.random()*10000);
       alert(timeOutInterval); //for Testing only
       var myVar;
       myVar = setTimeout(function(){ that.clickNextButton();}, timeOutInterval);
  });
  </code></pre>
  
  <p>If I launch the survey, this will lead to a page change after 1-11 seconds. If I preview the survey, this change will happen as well, followed by a second change. The alert will be shown twice as well. </p>
  
  <p>Does anyone have a solution, how this functionality could be tested in preview mode? </p>