How can I disable the timer from refreshing?

Kyle1878Kyle1878 Community Member Qubie ✭

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_UgamSaurabhPujare_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

Sign In to Comment