Several major desktop browsers run natively on macOS—Chrome, Firefox, Safari (of course), Opera, and soon Microsoft Edge. But if you’ve got a Mac and an Android phone (like me), how do you test your web projects on your mobile browsers? And how do you test on old versions of Internet Explorer? What about mobile Safari, which isn’t available on Android?

Testing on Your Android Browsers

On your Mac, open up System Preferences and click the Sharing icon. Activate the checkbox for Remote Management on the left. You should now see a message that says something like “Other users can manage your computer using the address 192.168.1.XXX”; that’s your Mac’s internal IP address, and you’ll want to jot it down.

Get your web project’s server up and running on your Mac. Say that the local site’s entry point is http://localhost:PORT. With your Android device connected to the same network as your Mac, open a browser on your phone and navigate to http://192.168.1.XXX:PORT. That should do the trick!

If this doesn’t work, it may be because your project’s HTTP server is only configured to listen for requests from the hosting machine’s internal IP. If that’s the case, you’ll need to explicitly tell it to listen on 0.0.0.0 instead. For example, this blog is powered by Jekyll, and if I run it locally by entering bundle exec jekyll serve in the command line, I cannot view it in my mobile browsers! The fix is to run it like this: bundle exec jekyll serve --host=0.0.0.0.

Testing on Internet Explorer 8–11 (or Edge)

Download VirtualBox. Then download and install the appropriate virtual machine from Microsoft. With your web project’s server running, open the browser on your virtual Windows machine, and navigate not to http://localhost:PORT but rather to http://10.0.2.2:PORT. Done!

Testing on Mobile Safari

Of all the modern browsers, Safari for iOS is maybe the quirkiest (e.g., the window.innerHeight property remains unaffected when the virtual keyboard is deployed, whereas it shrinks as you’d expect it to on all other major mobile browsers). So if you’re not testing on mobile Safari, you’re playing with fire!

Fortunately, if you’ve got a Mac but no iOS device, you can get yourself a virtual iOS device for free. First you’ll need Xcode. Once you have it, you’ll want to run the Simulator app that it comes with. You won’t find it in your Applications folder, but a Spotlight search will work (command + spacebar). In Simulator, go to Hardware > Device > iOS, and select the device you want. Get your web project’s server running, open Safari in your virtual iOS device, and navigate to http://localhost:PORT. (To get the virtual keyboard to deploy when clicking an input box, try command + K.)

Hope you found this guide helpful!