Tech News
← Back to articles

Document.write

read original related products more articles

This is really cool:

...blah... ... blah blah...

Under the hood it works like this:

function writeImage(url, title) { document.write(`

${title}
`); }

And leads to:

...blah...

My dog
...blah blah...

Whoa, HTML templating? It inserts the stuff directly where the function is called, and it just works? And it's been available in browsers forever? Stop the presses, I gotta rewrite all my static sites

The same approach works for reusing chunks of HTML between pages:

...page content...

when in common.js you have something like this:

... continue reading