A quick way to preview your local changes on a real mobile device could save you quite some time when working on websites and web applications. In this article, you will learn how to easily access a localhost website from your mobile device.
Connecting manually
- Step 1: Start your localhost website and take note of its PORT number (example:
8080
). - Step 2: Find your local IP address (example:
555.55.55.555
). - Step 3: on your mobile device, open the following URL in any browser:
IP:PORT
(example:555.55.55.555:8080
).
Connecting with localview
localview is a free, open-source, CLI written in JavaScript. It detects your IP address and generates a QR that can easily be scanned by any mobile phone.
- Step 1: Start your localhost website and take note of its PORT number (example:
8080
). - Step 2: Create a QR code with localview:
npx localview --port 8080
- Step 3: To visit the exposed URL, scan the QR code with your mobile device.