From 8cf168f6c1b869b777dd05b98dc23304f7bf0d9c Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 17 May 2024 12:31:48 +0200 Subject: [PATCH] display the the experiment's JSON data in a new window --- jspsych-uil-utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jspsych-uil-utils.js b/jspsych-uil-utils.js index 4fd1b73..de5c206 100644 --- a/jspsych-uil-utils.js +++ b/jspsych-uil-utils.js @@ -405,12 +405,13 @@ function saveJson (json, access_key, acc_server = undefined) { else { // show the data in prettyfied format json = JSON.stringify(JSON.parse(json), null, 4); - // clear the body - document.body.innerHTML= ''; // Add preformatted json content. let pre_element = document.createElement("pre"); pre_element.innerText = json; - document.body.append(pre_element); + + let content = `

Experiment Data (debug version)

${pre_element.outerHTML}`; + let url = URL.createObjectURL(new Blob([content], {type: 'text/html;charset=utf-8'})); + window.open(url); } }