Test Dev Website on Local Network (Home Wi-fi)


Testing

Updated Jun 28th, 2021

Wanting to access/test local sites in development from another computer/device on your local network? Access dev site via different devices like iOS to see how it looks pre-deployment. I noticed an error that doesn’t show on chrome but does show on safari.

Most of the testing needs to be done with iOS/Safari since this I don’t have access. There has to be an safari emulator right?

Replace you device labs and virtual machines with Browserstack.com that costs $25-$39 a month. This site looks like the authority on cross-browser testing.

I have an old ipad running ios version 9.3.5 and cannot be upgraded.

For a basic vanilla JS site this is pretty easy. In “Git a Web Developer Job” course see the video titled WebPack dev server at the 12:30 mark. Add this ability to see dev site from any device on home network by visiting 127.0.0.01 – to do this in the devServer object in your webpack.conif.js file add a host: ‘0.0.0.0’, be sure to add quotes around zeroes, and this will allow you to go to your-local-ip-address:3000 to see the site. Find the local ip address of the windows computer you are building/working on by typing ip config into cmd line and looking for ipv4 address. Mine is 192.168.1.164 so I type this in and add :3000 to access on the testing device. This works with vanilla js/webpack setup but not for flywheel and I’m sure not with next.js

Can also checkout this site to find you ip address.

With next.js this is handled out of the box with npm run dev. With that script running go to you-ip:3000 in the testing device on your local network and you will see it. For an example of the reason this is necessary, I took a look at bv.com on the ipad and the dark theme didn’t load bg color so looked terrible. Also confirmed scroll behavior of smooth doesn’t work. Also the “gotop” button doesn’t work as intended and I think this is because iOS waits until scrolling stops completely to run function.

According to this article, you need a virtual box with local by flywheel? On the official localwp.com site here it says temporary ngrok domain is your best option. Nothing is ever easy. Spending more time on their website directly I found out about live links and am wondering if this is a solution and how much it costs (Pro is $20 a month). Live links free works, but is not the best solution because you have don’t have HMR. It essentially uses ngrok to give you a fake link.

Live Links Pro: Quickly review site responsiveness across devices with our secure, persistent URLs. With longer timeouts and connection limits, your clients and coworkers can review work on their own time!

Free version of live link? To use the Live Link functionality simply:

  1. Click on “Enable” by “Live Link” in the bottom of the site info panel for the site you want to share
  2. Copy the URL that’s provided. It should look something like e31f5650.ngrok.io
  3. Leave your computer and Local running for the duration that you would like to share the site. As soon as you close your laptop or Local, the Live Link will turn off and your client won’t be able to see the site anymore. Also, the URL changes every time you re-enable the Live Link.