Relative Content

Tag Archive for javascripthtmlgithubdata-uri

Why does my data URL not fetch and exicute the JavaScript?

I want to have a data url that fetches code from my two github repos, just like this one (not mine, but working) data:text/html, function getHtml(file){ return new Promise((resolve) => { fetch(file) .then((response) => response.text()) .then((html) => { resolve(html); }); }); } async function start(){ var html=await getHtml(‘https://cdn.jsdelivr.net/gh/dragon731012/caudns/data.txt’); html=html.toString(); console.log(html); document.body.innerHTML=html; } start();