Skip to content

Instantly share code, notes, and snippets.

@mgechev
Last active May 21, 2020 18:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgechev/8113e350ee1e1401b43878620cb6a234 to your computer and use it in GitHub Desktop.
Save mgechev/8113e350ee1e1401b43878620cb6a234 to your computer and use it in GitHub Desktop.
data:text/html,<body onload="setInterval(()=>document.body.innerText=new Date().toLocaleTimeString())"></body>
@tkglaser
Copy link

This would work better with other locales:

data:text/html,data:text/html,<body onload="setInterval(()=>document.body.innerText=new Date().toLocaleTimeString())"></body>

@mgechev
Copy link
Author

mgechev commented May 18, 2020

Good point! Updated.

@navin-moorthy
Copy link

Quick Question: why this HTML has data:text/html twice when we can achieve this result with

data:text/html,<body onload="setInterval(()=>document.body.innerText=new Date().toLocaleTimeString())"></body>

@mgechev
Copy link
Author

mgechev commented May 21, 2020

It's a typo. The schema should be set only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment