Neues Fetch API zum Laden von Files (Ersatz von XMLHttpRequest)

Fetch basiert auf async und await:
async function getText(file) {
   let obj = await fetch(file); // fetch returns a Promise
   let txt = await obj.text();
   show(txt);
}
Noch kürzer mit .then-keyword
fetch(file)
.then(x => x.text())
.then(y => show(y));

Es hat aber den großen Nachteil, daß es auf GET aufbaut und damit uU den Cache nicht updatet!

Kompletter JavaScript code:



  
Lädt dieses File und zeigt es unten an: