DEV Community

Cover image for How to Test Local Website on Mobile Devices

How to Test Local Website on Mobile Devices

CodingNepal on June 13, 2024

This article was originally published at https://www.codingnepalweb.com. When building a website, developers often need to test if their site is...
Collapse
 
ghoshbishakh profile image
Bishakh Ghosh • • Edited

Once can also try pinggy.io/
Paste one command as ssh -p 443 -R0:localhost:8000 -L4300:localhost:4300 qr@a.pinggy.io and get a QR code to the public URL for your localhost port.

Image description

Collapse
 
akhileshgautam1903 profile image
Akhilesh gautam •

If you are developing react app then you have to use -- host flag to expose the link to the devices connected to your network
npm run dev -- --host

Image description
run this in cmd and you'll get the link for viewing your localhost in other devices

You can specify ip address after host but I recommend leaving it as it is.
I hope this helps..

Collapse
 
patadiarushabh profile image
Rushabh Patadia •

Thanks @codingnepal for this amazing tips.

Collapse
 
codingnepal profile image
CodingNepal •

You're welcome! Glad you found the tips useful!

Collapse
 
andrewkimdev profile image
Andrew B Kim •

In VSCode, you can use port forwarding with your github account. Then the rendered website is available not only in the local network but also from the Internet in general, e.g., your G3/LTE network.

Collapse
 
tevin_enadeghe_906b3c9eb3 profile image
Tevin Enadeghe •

Can you throw more light on this please

Collapse
 
syedmuhammadaliraza profile image
Syed Muhammad Ali Raza •

Nice

Collapse
 
codingnepal profile image
CodingNepal •

Thank you :)

Collapse
 
sourabpramanik profile image
Sourab Pramanik •

Ngrok is the beast here, try it. You can even share the public URL with anyone around the globe without exposing your IP, doing ssh, or sharing the same network.

It creates a proxy tunnel and all you have to do is map it to the right port in one command.

Collapse
 
antoniofromlitlyx profile image
Antonio •

Keep up the good work!
Sharing love from Italy ! 🇮🇹

Collapse
 
codingnepal profile image
CodingNepal •

Thank you! Greetings to Italy!

Collapse
 
codingnepal profile image
CodingNepal •

Thanks! I'm glad you found it useful for beginners! 👍

Collapse
 
martinbaun profile image
Martin Baun •

Nice! :)

Collapse
 
codingnepal profile image
CodingNepal •

Thank you :)

Collapse
 
codecruncher86 profile image
Chris Newton •

Thanks for sharing, this is really helpful!

Collapse
 
codingnepal profile image
CodingNepal •

You're welcome! Glad you found it helpful!

Collapse
 
melikhaya_mzola profile image
Mzola Melikhaya •

You've changed my life in coding, Thank you very much

Collapse
 
codingnepal profile image
CodingNepal •

I'm so glad to hear that! You're very welcome!

Collapse
 
shailendra_singh_rawat profile image
Shailendra Singh •

thank for this tip

Collapse
 
shivakumar08 profile image
Shivakumar •

Thank you, this helped me.

Collapse
 
asas profile image
A s •

Hi
I tried the above but it didn't work.
Can anyone tell me whats gone wrong.

Collapse
 
henryford12 profile image
Val •

Did you try on wi-fi and not lan/ethernet?
It seems to be working only on wifi, doesn't work on lan/ethernet

Collapse
 
asas profile image
A s •

Yeah I did it on same wifi to which my phone and laptop is connected but still it didn't worked.

Collapse
 
dapanda profile image
DaPanda •

That's very helpful, thank you for this!

Collapse
 
tevin_enadeghe_906b3c9eb3 profile image
Tevin Enadeghe •

Wow... thanks this is great

Collapse
 
aymn111 profile image
Aymen •

thank you