有没有办法从 Cocoa WebView 对象使用 WebKit Web 检查器? [英] Is there a way to use the WebKit web inspector from a Cocoa WebView object?

查看:22
本文介绍了有没有办法从 Cocoa WebView 对象使用 WebKit Web 检查器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 OS X 上基于 WebKit 的自定义浏览器中使用 WebKit 网络检查器.是否可以在 webview 对象上使用网络检查器?如果是,怎么办?

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?

推荐答案

在发送 -[NSUserDefaults registerDefaults 时,在默认用户默认设置中将 WebKitDeveloperExtras 设置为 YES:].这当然适用于整个应用.

Set WebKitDeveloperExtras to YES in your default user defaults when you send -[NSUserDefaults registerDefaults:]. This applies app-wide, of course.

请记住,用户可以将其更改为 NO,所以不要假设它是 YES——如果它很重要(例如,在自定义上下文菜单时),经常检查.

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.

警告:此首选项不一定只启用元素检查器.Apple 可能会在未来扩展它以控制菜单栏中的调试菜单.您可能会发现这是一个不可接受的风险.

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.

这篇关于有没有办法从 Cocoa WebView 对象使用 WebKit Web 检查器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆