Debugging HTML in iOS webview

14,046

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."

Share:
14,046
Artvader
Author by

Artvader

Updated on June 08, 2022

Comments

  • Artvader
    Artvader almost 2 years

    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.

  • Artvader
    Artvader about 6 years
    But this only applies to website opened in iOS safari, right? I'm talking about websites that are inside another App, embedded in webview.
  • dev
    dev about 6 years
    No, I'm talking about webview inside an iPhone app. Just try it. Run your app in the device. See to it that webvirw is visible. Now open safari on mac and do as described in the screenshot.
  • Artvader
    Artvader about 6 years
    Does the app developer have to write something in the App first to enable this or is this on by default on all Apps?
  • dev
    dev about 6 years
    It's enabled by default.
  • dev
    dev about 6 years
    Take a look at this link for further info - appletoolbox.com/2014/05/use-web-inspector-debug-mobile-safa‌​ri
  • Artvader
    Artvader about 6 years
    I did try it, actually. So strange that when I open a webpage in Safari, I do get the option to view it in inspector. But when I open our App that has a webview, the inspect options aren't showing.
  • dev
    dev about 6 years
  • Lorenz
    Lorenz over 5 years
    works like a charm. how unexpected! i ran it in the simulator. thank you!
  • Savado
    Savado almost 4 years
    @SonuVR This doesn't work for the webview in the LinkedIn app, unfortunately... Any idea? EDIT: I found out this only works for apps installed using Xcode. "You can only debug webviews in applications loaded onto your device through Xcode. You can't debug webviews in apps installed through the App Store or Apple Configurator."
  • chovy
    chovy about 2 years
    Anyway to do this with Linux? I don’t have a mac