Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging HTML in iOS webview

Android can use desktop Chrome's web inspector to debug HTML/CSS issues embedded in an App's WebView, as long as you connect them through USB.

I've been searching all over google and this site and cannot find any information regarding this. Is there a similar way to inspect HTML/CSS elements/rules in iOS?

Because there are some issues that only affects webview, so viewing it from iOS Safari cannot reproduce some issues.

like image 787
Artvader Avatar asked Apr 19 '18 02:04

Artvader


People also ask

How do I debug a WebView app?

Open an Android WebView in DevTools To display a list of the Android WebViews with debugging turned on that run on your device, go to edge://inspect . To start debugging, under the Android WebView you want to debug, click inspect. Use DevTools in the same way that you use a remote browser tab.

Does WebView work on iOS?

WebView can be defined as an object which can display the interactive web content and load HTML strings within the iOS application for an in-app browser. It is an instance of the WKWebView class, which inherits the UIView class.

How do I debug Chrome iOS?

How: In Chrome on your iPad or iPhone, go to chrome://inspect and then press Start Logging. Now go do your thing in another tab, keeping this tab open. Come back anytime to see any and all console outputs!


1 Answers

You can do this using Safari on Mac. First, go to settings on iPhone → Safari → Advanced. Then enable the "Web Inspector" option and follow the instructions to enable on Mac.

Edit: this will only work with apps installed using Xcode.

Screenshot of iOS Safari settings advanced page with Web Inspector  option enabled. Explanation below that option reads "To use the Web Inspector, connect to Safari on your computer using a cable and access your iPhone from the Develop menu. You can enable the Develop menu in Safari’s Advanced Preferences on your computer."

like image 121
dev Avatar answered Sep 23 '22 06:09

dev