I would like to use the WebKit web inspector in a custom browser based on WebKit on OS X. Is it possible to use the web inspector on a webview object? If so, how?
A REALLY easy way to do it... is in the terminal.... ⌘ ⬆ ☺
defaults write com.yourcompany.yourbundleid WebKitDeveloperExtras TRUE
(With OSX 10.8, use defaults write com.yourcompany.yourbundleid WebKitDeveloperExtras -bool true
instead).
NOTE: You MUST change com.yourcompany.yourbundleid
to YOUR specific "apps" (or whatever company's app bundle ID
it may be) before this will work!**
The nice thing about this... there is NO WAY to forget to take it out, turn it off, comment it out, etc... This is a LOCAL setting... and can be set for ANY webkit enabled app... If you don't see a Developer Menu, or whatnot.. fret not..
Right☝ (click) on the Webview and go to "Show Inspector".
Also, along the same lines, the following may do something as well.. but I havent tried it, so not sure..
defaults write com.yourcompany.yourbundleid IncludeDebugMenu 1
Set WebKitDeveloperExtras
to YES
in your default user defaults when you send -[NSUserDefaults registerDefaults:]
. This applies app-wide, of course.
Remember that the user can change it to NO
, so don't assume that it's YES
—if it ever matters (e.g., when customizing the contextual menu), always check.
Warning: This preference doesn't necessarily only enable the Element Inspector. Apple may extend it in the future to also control, say, a Debug menu in your menu bar. You may find this an unacceptable risk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With