Live data from Hacker News

Web apps in a single, portable, self-updating, vanilla HTML file

hyperclay.com

151–160 of 240 posts

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#152

Earlier quoted context omitted.

How does this differ from htmx?

htmx requires a server. This enables a single html file to modify itself.

No, this need a server too. Everything that saves changes to non local (shareable) locations needs some kind of a server. The best solutions are of course when OP hosts the server and you pay for it /s

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#153

Earlier quoted context omitted.

A significant hindrance for generator-type apps is that only pages loaded via HTTPS have access to the clipboard API, so ”copy to clipboard” does not work via file:///. You can have a zero-build zero-dependency offline-only app which users could theoretically just save as a page, but copy buttons will not work, so you have to detect the API not being available and replace buttons with popover textareas. Clunky. As fo…

This is so weird that a random website on a random server (having SSL doesn’t change that in the slightest) is considered less of a risk than a file I have on my own computer. Can somebody help me understand what’s going on?

The random website cannot access arbitrary files on your computer's file system and send it somewhere else. An html file with javascript running locally, if trusted, on a typical personal computer could do that.

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#155

Earlier quoted context omitted.

A significant hindrance for generator-type apps is that only pages loaded via HTTPS have access to the clipboard API, so ”copy to clipboard” does not work via file:///. You can have a zero-build zero-dependency offline-only app which users could theoretically just save as a page, but copy buttons will not work, so you have to detect the API not being available and replace buttons with popover textareas. Clunky. As fo…

This is so weird that a random website on a random server (having SSL doesn’t change that in the slightest) is considered less of a risk than a file I have on my own computer. Can somebody help me understand what’s going on?

There’s some discussion in the specs here https://w3c.github.io/webappsec-secure-contexts/#is-origin-t...

> In particular, the user agent SHOULD treat file URLs as potentially trustworthy.

> User agents which prioritize security over such niceties MAY choose to more strictly assign trust in a way which excludes file.

A potentially trustworthy URL is a secure context: https://html.spec.whatwg.org/multipage/webappapis.html#secur...

So this is a matter of browsers not implementing it, probably because there’s just not a lot of demand for it.

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#156

I would like web standards have better support for pages stored in a local file (opened using file:// protocol). Sometimes I write simple HTML/Vue based mini-apps for myself and every time something doesn't work and I need workarounds, for example: - local HTML file cannot import local JS modules, so I have to use legacy writing style - local HTML file cannot open other local files (for example, audio files) I unders…

I have been using python http server to get this working. Go to a place where you have your index.html, start a python server, python3 -m http.server, and voila, everything is now importable and locally accessible.

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#157
post #35

For people who are confused: Hyperclay is a NodeJS server and frontend JS library that allows HTML pages to update their DOM and then replace their own .html source with the updated version. Imagine clicking a checkbox, which adds the `checked` attribute to its element, then using Hyperclay to globally persist this version of `document.body.outerHTML`, so that it's there next time someone visits the page. There's aut…

To be completely honest, I don't see how this is more useful than adding a sync layer to localStorage. I did make a service that does that at htmlsync.io and am genuinely curious how this solution is better.

Just like with https://tiddlywiki.com/

Your notes are the HTML file! You can keep it in your documents folder, sync it via any service, track it in version control, etc. It’s for folks who know what the filesystem is, don’t know how to host a server (or don’t want to), but want a website-like experience. Works offline, too!

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#159
post #34

To take this concept one step further towards perfection, you would want to lose the backend completely and persist directly to a git repo using https://isomorphic-git.org/

I like the idea! You would still need something to serve the HTML file, but that isn't so bad.

But in my experience the potential audience shrinks significantly once anything git related is expected from a user.

Re: Web apps in a single, portable, self-updating, vanilla HTML file

#160
post #34

To take this concept one step further towards perfection, you would want to lose the backend completely and persist directly to a git repo using https://isomorphic-git.org/

It stinks github or gitlab or any free git hosting providers didn't work with isomorphic git.
Post reply on HN