Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

How can I disable the timer from refreshing?

Hi,

I am trying to run a short quiz style survey. The quiz contains ten questions with a 10 second countdown timer on each question. I want respondents to proceed to the next page / question once the time runs out.

However, respondents can refresh the page and the timer appears to reset. Is there any way to either:

  • Set the timer to continue from the same point after refresh?
  • Disable the refresh option on the page to prevent this?

Either of the above would solve the problem.

Any help would be much appreciated.

Kyle

Tagged:

Best Answer

  • SaurabhPujare_Ugam
    SaurabhPujare_Ugam India Sage ✭✭✭
    edited September 2018 Accepted Answer

    @Kyle1878 ,

    Hope this helps,

    Qualtrics.SurveyEngine.addOnReady(function()
    {
        /*Place your JavaScript here to run when the page is fully displayed*/
        document.onkeydown = function()
        {
      switch (event.keyCode)
                {
            case 116 : //F5 button
                event.returnValue = false;
                event.keyCode = 0;
                return false;
            case 82 : //R button
                if (event.ctrlKey)
                { 
                    event.returnValue = false;
                    event.keyCode = 0;
                    return false;
                }
        }
    
    
    }
    
     window.oncontextmenu = function () {
                console.log("Right Click Disabled");
                return false;
            }
    });
    

    Above mentioned code may still stop the user from Refreshing the page using F5, ctrl-R and right click.
    However, It is not possible to completely stop user from Refreshing the page.

Answers