[WEBVIEW] Enable inspector (how to)

Here is the required code to enable the inspector in the webview on macos.
This adds the inspector option to the right click menu.

File: juce_mac_WebBrowserComponent.mm 
Method: WKWebViewImpl::WKWebViewImpl()
add:[webView.get().configuration.preferences setValue:@YES forKey:@"developerExtrasEnabled"];

It would be handy to have this enabled by default in Juce. Will you consider ?
(Inspector is already enabled by default using Webview2 on Windows)

2 Likes

That’s very very useful!
I agree it would be great if this was enabled by default or configurable in some way. For now I guess I’ll need to make my own fork of JUCE to get this change applied!

Yes, we also need that. Currently we adding this line by extending our JUCE download script with this line

sed -i '' '525i\
         [webView.get().configuration.preferences setValue:@(true) forKey:@"developerExtrasEnabled"];' JUCE/modules/juce_gui_extra/native/juce_mac_WebBrowserComponent.mm

But we have to check if this is working with every new release of JUCE.

And yes, this is already enabled by default on Windows with the shortcut Ctrl+Shift+I. This is really useful for our support team if something unexpected happened on a customers machine.