If you're doing any kind of web development work these days, you probably need your website or app to run on mobile phones.
By default, your iPhone or iPad won't be able to access an app that's running on localhost on your desktop (unless you're running the simulator).
If both your computer and your phone are in the same network however, you can take your phone and navigate to the local IP address of your computer.
Go the Mac App Store and download IP Friend. Then, go ahead and open the app.
Click the "IP" icon in your menubar to copy your IP address.
If you have your localhost address in your clipboard (e.g. http://localhost:3000
), you can hold
down Option ⌥ with the IP menu open to replace the "localhost" part with your IP. http://localhost:3000
then becomes something like
http://192.168.0.1:3000
.
macOS and iOS share a clipboard thanks to iCloud Clipboard, so you can now simply paste the IP address in Safari's address bar on your iPhone.
Don't forget to add http://
and the port if necessary!
Watch the following video to see how easy it is to open localhost website with IP Friend:
Hi, I’m Max! I'm a fullstack JavaScript developer living in Berlin.
When I’m not working on one of my personal projects, writing blog posts or making YouTube videos, I help my clients bring their ideas to life as a freelance web developer.
If you need help on a project, please reach out and let's work together.
To stay updated with new blog posts, follow me on Twitter or subscribe to my RSS feed.