iOS Safari - Debug a Mobile Site
When an iOS device is connected via Remote Debugging, your machine treats it as if it is connected locally via USB.
This allows Safari to see the device as locally connected which is why it then enables you to debug your mobile site.
-
Make sure Web Inspector is enabled on your iOS device. Click Settings -> Safari -> Advanced and enable Web Inspector.
-
When debugging mobile sites using Safari on Mac, Safari must be closed before the Remote Debugging session is initiated. To do this:
-
Use Chrome to open the device and initiate the Remote Debugging session.
-
Start the session from command line: ./rdb start-remote-debug --url <> --access-key <> --serial-number <>
-
Open Safari on your Mac machine, and then the developer tools.
-
If you encounter issues when inspecting Safari might have some issues, add --debug-safari to the command line: ./rdb start-remote-debug --url <> --access-key <> --serial-number <> --debug-safari
-
If the session was started, but you cannot inspect websites on the debugged device:
- Locate the *.vmoptions file in the installation directory.
- Add -Ddebug.safari=true to the *.vmoptions file, followed by a line break.
- Restart the remote debugging service.
Set up
- Open a device in manual mode.
- Open a Remote Debugging session.
- Open Safari on the device.
- Navigate to the site to debug.
Connect to the Device and Open a Site
- Open Safari on your Mac.
- At the top menu bar click Develop.
- Click the device, then click the site that you opened in Set Up.
Inspect and Debug
Once you click the site that you previously navigated to, a window opens showing the DOM structure and CSS.
Hover over the DOM to determine the location of elements in the site and change the CSS to see how the site reacts to changes.