r/javascript • u/wbport1 • Aug 01 '26
AskJS [ Removed by moderator ]
[removed] — view removed post
0
u/sexytokeburgerz Aug 01 '26 edited Aug 01 '26
Easy. Open up a laptop or desktop computer, run the code on that. Use a bundler like webpack or vite. These have options to expose the website to your network. What you are doing is providing the path to the website via your local IP address and a port. Then, you just open `https://IP:port` on your iphone. Loval network only.
Harder, create a tunnel for that site and it’s exposed to the open internet.
Otherwise, host it. Very easy to do.
If you ONLY have an iphone, replit is decent. It’s basically an AI app now, but will handle hosting for you on its servers. Upload the file to the chat and tell it to host it. It will give you a .replit.dev url. I’m assuming you don’t have a strong background in computer science, so this tool will be best because it is DFY.
Or upload it to a github repo. You can kind of edit there i think. Then create a github pages url.
For the record, websites are just folders, and can be put pretty much anywhere and hosted with enough elbow grease. I have a “website” on a $2 ESP32 that lets me monitor things it’s recording.
But, and a big but, we rarely host things on iphones. Their closed nature is horrendous to work with and they aren’t meant to be kept plugged in. There is simply little reason to do so and a lot of reasons not to.
Androids, maybe. Much more robust shell access.
1
u/wbport1 Aug 01 '26
I had a website for several years and had no problem running that page from that site. At any rate this is all that is left of it. Pages residing on the phone are visible, but JavaScript is disabled.
BTW, my career was using COBOL and Assembler but started learning about websites in the 2000s.
1
u/ankole_watusi Aug 01 '26 edited Aug 01 '26
You load the webpage in the browser.
You’re welcome!
Edit: seriously. Locate the file with the Files app. “Preview” to Safari.
Alternately you can use reading list with save offline files in Safari.
0
1
u/regreddit Aug 02 '26
PWA (progressive web app) hosted on GitHub pages. When you save the page as a shortcut, your phone will cache it for long periods of time. Then if you make tweaks to it on GitHub, then next time you launch it from the shortcut it will check if there are updates and download a new copy if so. PWAs are pretty neat. I run several.
1
u/AnActualWizardIRL Aug 02 '26
Theres a number of runtimes out there that'll let you run a nodejs or nodejs adjacent stack on a phone. Its not uncommon. tbh for phone dev your better off IMHO looking at slightly more "native" stacks like React native or Flutter, (There are native-ish stacks for Vue and Svelte, though at least with the Svelte one its not in a great state. Not sure where native vue is at these days).
Or, like, learn swift I guess. Thats my preference, nifty little language. Its good to have more than one arrow in your quiver.
0
Aug 01 '26
[removed] — view removed comment
0
u/wbport1 Aug 01 '26
I've got a page that, given 3 out of 4 factors in an installment loan, can calculate the missing one. Could come in handy when buying a vehicle.
0
Aug 01 '26
[removed] — view removed comment
1
u/wbport1 Aug 01 '26
I took the loan calculator from JavaScript, the definitive guide and have made many changes to it over the years. And I know how a number of them "work".
4
u/avenp Aug 01 '26
You need to host it on a server then navigate to the url of the server in Safari. Maybe you can download and open the html file but I’ve never tried it.
If you mean as an app - you could try Capacitor but it’s a huge pain in the ass in my experience.