var h5pScript = document.createElement("script"); h5pScript.setAttribute("charset", "UTF-8"); h5pScript.setAttribute("src", "https://h5p.com/canvas-resizer.js"); document.body.appendChild(h5pScript);