News for hackers. Stuff that matters.
Re:Web apps in a single, portable, self-updating, vanilla HT... by mcteamster on Monday August 18, 2025 @05:35AM (#44938824)
Been doing something similar with save files for my game. Line 1 is "<!DOCTYPE html><html><head><script>const rawData =" and line 2 is all the state.

Then the save button downloads document.documentElement.outerHTML with line 2 replaced by the current state. No server required.

https://github.com/mcteamster/white/blob/main/src/lib/data.t...

Re:Web apps in a single, portable, self-updating, vanilla HT... by fallinditch on Monday August 18, 2025 @02:37PM (#44943839)
I am trying something similar: I made game as a standalone HTML file with a feature that allows users to edit text and save as a new local version. Works on my phone (Android with Brave) but not on iOS with Safari.
Re:Web apps in a single, portable, self-updating, vanilla HT... by qingcharles on Monday August 18, 2025 @06:22PM (#44945919)
I keep this bookmark in Chrome which lets me open an editor in a tab and Chrome maintains the state of the textarea even through reboots as long as you don't close the tab:

data:text/html,<html><head><title>Notepad</title><style>html,body{margin:0;padding:0;}textarea{padding:10px;font-family:Courier;font-size:16px;height:100%;width:100%;border:none;outline:none;}</style></head><body><textarea style="height:100%;width:100%;font-size:16px;padding:10px;"></textarea><script>document.getElementsByTagName('textarea')[0].focus()</script></body></html>

Re:Web apps in a single, portable, self-updating, vanilla HT... by b2ccb2 on Tuesday August 19, 2025 @10:36AM (#44952021)
You can get rid of the JS by setting the autofocus[1] attribute to the textarea.

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

Re:Web apps in a single, portable, self-updating, vanilla HT... by qingcharles on Tuesday August 19, 2025 @08:55PM (#44957680)
Thank you, I'm going to try this.
Re:Web apps in a single, portable, self-updating, vanilla HT... by qingcharles on Wednesday August 20, 2025 @03:10AM (#44959436)
Thanks, I trimmed it down to this:

  data:text/html,<title>Notepad</title><textarea autofocus spellcheck=0 style="position:fixed;inset:0;padding:1em;border:0;font:monospace">