|
| 1 | +--- |
| 2 | +title: Remote debugging WebViews |
| 3 | +sidebar_label: Remote debugging |
| 4 | +--- |
| 5 | + |
| 6 | +You can remotely debug the content in your webviews using Chrome for Android or Safari for iOS. |
| 7 | + |
| 8 | +## Summary |
| 9 | + |
| 10 | +- Enable WebView debugging |
| 11 | +- Access list of debug-enabled WebViews via chrome://inspect |
| 12 | +- Debugging WebViews is the same as debugging a web page through remote debugging. |
| 13 | + |
| 14 | + |
| 15 | +## Configure WebView |
| 16 | + |
| 17 | +WebView debugging must be enabled from within your application. To enable WebView debugging set the `enableDebugging` flag to `true` in the `WebViewOptions` used to create your webview: |
| 18 | + |
| 19 | +```actionscript |
| 20 | +var options:WebViewOptions = new WebViewOptions(); |
| 21 | +options.enableDebugging = true; |
| 22 | +
|
| 23 | +... |
| 24 | +
|
| 25 | +var webView:WebView = NativeWebView.service.createWebView( viewPort, options, stage ); |
| 26 | +``` |
| 27 | + |
| 28 | +On Android this setting applies to all of the application's `WebView`s whereas on iOS it applies to the specific instance. |
| 29 | + |
| 30 | + |
| 31 | +## Inspect the WebView |
| 32 | + |
| 33 | +### Android |
| 34 | + |
| 35 | +The chrome://inspect page displays a list of debug-enabled WebViews on your device. |
| 36 | + |
| 37 | +To start debugging, click inspect below the WebView you want to debug. Use DevTools as you would for a remote browser tab. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +The gray graphics listed with the WebView represent its size and position relative to the device's screen. If your WebViews have titles set, the titles are listed as well. |
| 42 | + |
| 43 | +### iOS |
| 44 | + |
| 45 | +Firstly open the settings and enable Web Inspector on Safari. |
| 46 | + |
| 47 | +- **Settings** > **Safari** > **Advanced** |
| 48 | +- toggle the Web Inspector option on |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +Then in Safari on your development machine you will need to enable developer mode: **Safari** > **Settings** > **Show features for web developers** |
| 54 | + |
| 55 | +Under the **Develop** menu find the device you wish to inspect and it should open the code inspection view. |
| 56 | + |
| 57 | + |
| 58 | +## Troubleshooting |
| 59 | + |
| 60 | +### Android |
| 61 | + |
| 62 | +Can't see your WebViews on the `chrome://inspect` page? |
| 63 | + |
| 64 | +- Verify that WebView debugging is enabled for your app. |
| 65 | +- On your device, open the app with the WebView you want to debug. Then, refresh the `chrome://inspect` page. |
| 66 | + |
| 67 | + |
0 commit comments