Last Updated: September 09, 2019
·
4.022K
· kevinsuttle

Previewing your local webserver on mobile emulators

For iOS, (assuming XCode is installed): Run the following from the Terminal:

ln -s /Applications/Xcode.app/Contents/Applications/iPhone\ Simulator.app /Applications/iOS\ Simulator.app

via my dotfiles

Then, you can navigate to http://localhost:XXXX as usual.

For an Android emulator, simply open your browser and navigate to 10.0.2.2. which is a way of telling the emulator "not your localhost, the machine the emulator is running on, that localhost".

via the Android Developer site