}, 1000);

    // Reloads the screenshot. We first set the source to an empty string so that the spinner in
    // the background gets visible.
    function reloadScreenshot() {
      document.getElementById('screenshot').src = "";
      document.getElementById('screenshot').src =
        "/capture?width=1200&height=600&delay=10&gui=false&restoreState=true&random=" + new Date().getTime();
    }

    // Initial loading.
    reloadScreenshot();

    // Runs the given JavaScript code on the CosmoScout VR backe