Urgent.News

What's breaking now, across thousands of outlets.

Culture

Inline rendering with document.currentScript

Inline rendering with document.currentScript Lean Rada describes a neat trick that takes advantage of the document.currentScript property. You can use that to drop in a tiny inline <script> element that replaces itself when the page loads: The year is <script> document.currentScript.replaceWith( new Date().getFullYear())</script> If you define a shortcut function like this:…

We haven't written up this one. Simon Willison has the full story — the link below goes straight to it.

Read the original at simonwillison.net →

More in Culture

More from Saturday 17 October →