←back to thread

578 points smusamashah | 9 comments | | HN request time: 0.001s | source | bottom
Show context
egeozcan ◴[] No.42463511[source]
This is very cool. BTW, when developing single HTML file apps, instead of localStorage, one can use the HTML as the source of truth, so the user can just save/save-as to persist. I had mentioned my quick and dirty attempt at an image gallery that is a self-contained html file and some really liked the concept, if not the "app" itself: https://news.ycombinator.com/item?id=41877482
replies(6): >>42463631 #>>42464347 #>>42467577 #>>42471918 #>>42476577 #>>42477123 #
1. smusamashah ◴[] No.42467577[source]
Does using save as retain changes you make in the HTML (like aedits on a contenteditable element)? In my experience it does not. When you save, the originally loaded html will be saved, any changes in html stay in your browser.
replies(1): >>42468656 #
2. egeozcan ◴[] No.42468656[source]
My bad, I should have mentioned that you should choose the option to save the complete web page. It becomes default on Firefox once you select it. Not sure about Chrome and others.

It looks like this on Firefox, Windows: https://imgur.com/zNlEGgK

replies(1): >>42470583 #
3. rollcat ◴[] No.42470583[source]
Great idea, as usual killed in its infancy by lacking UA UX. We even already have an API to ask the user not to close the web page, because there's unsaved work; but it wouldn't work with "Save as...", because you can't detect that, and the browser won't do it for you, even if it knows you're editing a local file.

Same for all of the pointless cookie banners - they could've been UA prompts instead, putting the user in charge of setting a policy ("always trust example.com", "never trust example.net", "accept example.org for this session", etc). But building such prompts into a browser would've been a nuisance in 1997... So we ended up with that nuisance anyway, just enshrined by shortsighted laws, that target each and every website - rather than the three remaining browser engine vendors.

replies(2): >>42471994 #>>42479089 #
4. egeozcan ◴[] No.42471994{3}[source]
It's not killed IMHO, I actively use a fleet of such single HTML file apps that I save locally and even share with people. My initial comment has an example of a gallery, works wonderfully.
replies(1): >>42479232 #
5. tomcam ◴[] No.42479089{3}[source]
What is UA UX?
replies(1): >>42479210 #
6. rollcat ◴[] No.42479210{4}[source]
UA = User Agent (in this case, web browser). UX = user experience (catch-all term for "design", "how it works", integration, etc).
replies(1): >>42482141 #
7. rollcat ◴[] No.42479232{4}[source]
Well my issue is you forget to hit Ctrl-S/Cmd-S and your changes are gone. I've been using computers since early 90s and haven't found one program that does that; heck many apps don't even have an explicit "save" button, saving (and syncing) is transparent.

The web "browser" wasn't "intended" for this use case, hence the issue. This could be easily fixed though -- just like cookies.

replies(1): >>42479275 #
8. egeozcan ◴[] No.42479275{5}[source]
You can also use localstorage/indexeddb and keep syncing it with a script element of type text/json. On-load, see if localstorage is gone (different browser, domain, etc.) and restore from the script element if that's the case.

I explicitly do not want such a thing in many of my HTML-apps, but one could add it with relative ease.

9. tomcam ◴[] No.42482141{5}[source]
Was not hip to the UA part so couldn’t directly connect with the UX part, thanks