Earlier quoted context omitted.
Luckily, starting a local HTTP server for development is more-or-less a one-liner for a long time, in most OSes (maybe even Windows might ship with Python nowadays?): python -m http.server 8080 If if you're stuck with python2 python -m SimpleHTTPServer 8080 At least this doesn't introduce the security issues you'd see with any file:// resource being able to load other file:// resources
It's not perfect either: https://docs.python.org/3/library/http.server.html#http-serv... You should also add a `--bind 127.0.0.1` so you don't expose the site to everyone on your network.
I wrote a static web page and accidentally started a community (2023)
51–60 of 136 posts
Re: I wrote a static web page and accidentally started a community (2023)
#52Hey browser makers, please allow file:// URLS to actually be able to load other files in the same directory without giving a CORS error. You can't even run a JS file from the same directory! That's what's really killing "local first".
As usual, this sounds great for the nice players. Unfortunately that means if you download an html file and double click on it then it can send anything in your downloads folder to anywhere else.
Re: I wrote a static web page and accidentally started a community (2023)
#53Hey browser makers, please allow file:// URLS to actually be able to load other files in the same directory without giving a CORS error. You can't even run a JS file from the same directory! That's what's really killing "local first".
Re: I wrote a static web page and accidentally started a community (2023)
#54Earlier quoted context omitted.
That requires having an actual server though.
which is extremely easy to do. Most programming languages have a one-liner to do it.
Re: I wrote a static web page and accidentally started a community (2023)
#55The only annoying part was detecting when the browser was back online, I used some hacky solution since there was no native API for it for any browser at the time, but it worked.
Re: I wrote a static web page and accidentally started a community (2023)
#56Earlier quoted context omitted.
As usual, this sounds great for the nice players. Unfortunately that means if you download an html file and double click on it then it can send anything in your downloads folder to anywhere else.
Download HTML file (and dependencies), open local file, local JS requests from internet, and CORS error. Why can it not work like this?
I really don't understand what this means.
Re: I wrote a static web page and accidentally started a community (2023)
#57In our case we're building a local-first multiplayer "IDE for tasks and notes" [1] where the syncing or "cloud" component adds features like real-time collaboration, permission controls and so on.
Local-first ensures the principles mentioned in the article like guaranteed access to your data and no spinners. But that's just the _data_ part. To really add longevity to software, I think it would be cool if it would also be possible to guarantee the _service_ part also remains available. In our set up we'll allow users to "eject" at any time by saving a .zip of all their data and simply downloading a single executable (like "server.exe" or "server.bin"). The idea is you can then easily switch to the self-hosting backend hosted on your computer or a server if you want (or reverse the process and go back to the cloud version).
Re: I wrote a static web page and accidentally started a community (2023)
#58Earlier quoted context omitted.
I guess the main disadvantage is you can't reliably link to anything. Maybe not a problem if you only ever need one local server.
Maybe this is an opportunity. Is there already a “DNS for ports” whereby the hosts file is propagated with application process identifiers that are mapped to localhost:port in hosts file?
Re: I wrote a static web page and accidentally started a community (2023)
#59Earlier quoted context omitted.
Download HTML file (and dependencies), open local file, local JS requests from internet, and CORS error. Why can it not work like this?
> local JS requests from internet I really don't understand what this means.
I too like local HTML and would love to see it restored without requiring a local server. If I spin up a local Webrick to serve anything from my file system, I’m no better off (except maybe that it’s scoped to a particular directory and children).
Re: I wrote a static web page and accidentally started a community (2023)
#60Earlier quoted context omitted.
Luckily, starting a local HTTP server for development is more-or-less a one-liner for a long time, in most OSes (maybe even Windows might ship with Python nowadays?): python -m http.server 8080 If if you're stuck with python2 python -m SimpleHTTPServer 8080 At least this doesn't introduce the security issues you'd see with any file:// resource being able to load other file:// resources
It's not perfect either: https://docs.python.org/3/library/http.server.html#http-serv... You should also add a `--bind 127.0.0.1` so you don't expose the site to everyone on your network.