Earlier 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 wrote a static web page and accidentally started a community (2023)
61–70 of 136 posts
Re: I wrote a static web page and accidentally started a community (2023)
#62Hey 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".
(Alternately you could bundle multiple files into a single ePub, though that requires a few adjustments compared to simple HTML. It's a widely supported format and allows for scripting.)
Re: I wrote a static web page and accidentally started a community (2023)
#63Another aspect of local-first I'm exploring is trying to combine it with the ability to make the backend sync server available for local self-hosting as well. In 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…
Signed up for early access and looking forward to it!
Re: I wrote a static web page and accidentally started a community (2023)
#64Earlier 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.
To be safe, this should be used instead: `-p 127.0.0.1:8000:8000`
Re: I wrote a static web page and accidentally started a community (2023)
#65I never made anything fancy, but I never made anything for the web that I can't run locally. If I can't just sync the changed files to the web server and overwrite the DB (which for my use cases takes seconds), I'm not interested. If it needs to be in the domain root, I'm not interested. A bunch of files using relative paths and a config that checks for running on localhost and points to the local DB or the productio…
Nah I feel like this is the right approach. Apps got too complicated to maintain safely. Web development should be accessible and have good standards. It should be easier to build webapps over the years but its becoming harder and harder.
Like this little PHP script I had to spit out custom gradients before CSS had them, it's weird how fondly I remember that... it wasn't even special or complicated, but it was my grd.php and I used it everywhere :) And on some old pages I never got around to replacing it, I'm sure! Once it works, it just works.
Stay away from frameworks and pre-processors, but also study them (!) and make your own and you'll be fine (that is, you will have a lot less pointless churn). If in doubt, don't put sensitive info on it and don't allow visitors to. There is so much you can do where security really literally doesn't matter, because it's just something cool to make and show people.
Re: I wrote a static web page and accidentally started a community (2023)
#66Re: I wrote a static web page and accidentally started a community (2023)
#67Earlier quoted context omitted.
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?
Careening back to inetd and /etc/services …
Re: I wrote a static web page and accidentally started a community (2023)
#68Hey 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".
That and, bring back the "new tab" custom URL, and, a way to securely host local servers without root but also without just praying that another app doesn't port-squat me
Re: I wrote a static web page and accidentally started a community (2023)
#69Well, it's always amusing how they discover that applications can run locally without depending on someone else's servers and maybe without pulling unverified code from 50 random repos. Next they'll discover native applications! Innovation! Maybe after that they'll even discover that you can give a shit about the user's battery/power consumption and ram consumption again!
Re: I wrote a static web page and accidentally started a community (2023)
#70Hey 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".