html
html
1
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
html, body{
padding: 0;
margin: 0;
}
body{
width: 100vw;
height: 100vh;
background: #777;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
window.onload = () => {
var url = "https://raw.githubusercontent.com/HanumaUkkadapu/loadaFile2web/master/loadHTMLviaFetch/index.html";
/* "https://raw.githubusercontent.com/nuheen123/canvas/master/demo/index.html";*/
async function loadHTML(url) {
return await (await fetch(url)).text();
}
/*
** It is an IIFE.
** IIFE - Immediately Invoked function Expression.
*/
(async function populateDocument(url) {
const root = document.documentElement;
var doc = await loadHTML(url);
console.log(doc);
root.innerHTML = doc;
/*
** Calling the function loaded() after the
** document from the url has been loaded and
** inserted in the document.
*/
loaded();
}(url));
//populateDocument(url);
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run