How to show the inspector within your WKWebView based desktop app?

前端 未结 4 772
庸人自扰
庸人自扰 2020-12-14 15:56

I\'m looking for a way to show the inspector for a WKWebView inside my Mac app.

With WebKit1 and WebView it was easy to show the inspector inside your Mac app, by ju

4条回答
  •  自闭症患者
    2020-12-14 16:44

    This was patched here: https://lists.webkit.org/pipermail/webkit-dev/2014-August/026790.html

    Just expose the private property like this and you can use it.

    @interface WKPreferences (WKPrivate)
    @property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled;
    @end
    

    Now you get the "Inspect Element" menu on right click.

    The only thing I still need to find out is how to show the inspector directly from code.

提交回复
热议问题