[webkit-help] [Mac Desktop] Show Inspector With Code
Daniel Jalkut
jalkut at red-sweater.com
Mon Sep 8 07:20:48 PDT 2014
Hi Koen - is this just for development/debug purposes? You can obtain a reference to the private inspector object for a web view, and then interact with it in various ways. For example, given a reference to WebView* someWebView:
[[someWebView performSelector:@selector(inspector)] performSelector:@selector(show:) withObject:nil];
Should pop up its inspector assuming developer extras are enabled. Obviously you wouldn’t want to rely upon that fragile relationship for a shipping feature, though.
I wrote more about a use case for this where I automatically open the inspector when JavaScript errors occur. Search on "Step 3" for more details:
http://indiestack.com/2014/05/javascript-bug-traps/
Daniel
> On Sep 4, 2014, at 8:30 AM, Koen Bok <koen at madebysofa.com> wrote:
>
> Since the patch to allow developer extras landed:
> https://bugs.webkit.org/show_bug.cgi?id=135811
>
> I can set the _setDeveloperExtrasEnabled to get the "Inspect Element" menu on a right mouse click. It then nicely opens a new inspector window in my app.
>
> I would like to show the inspector with a button in my UI, so I was looking how to do that. Can anyone help?
>
>
> Thanks, Koen
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-help
More information about the webkit-help
mailing list