WKWebView *webView = initWithFrame:CGRectZero configuration:webConfiguration] įor JSContext, matching API is available, with the addition of C API for developers using JSGlobalContextRef: Swift let jsContext = JSContext() WebView.isInspectable = true Objective-C WKWebViewConfiguration *webConfiguration = So, for example, to make a WKWebView inspectable, you would: Swift let webConfiguration = WKWebViewConfiguration() This decision is made for each individual WKWebView and JSContext to prevent unintentionally making it enabled for a view or context you don’t intend to be inspectable. It defaults to false, and you can set it to true to opt-in to content being inspectable. How do I enable inspection?Īcross all platforms supporting WKWebView or JSContext, a new property is available called isInspectable ( inspectable in Objective-C). Now, this same functionality is available through an API on WKWebView and JSContext. However, released versions of apps had no way to inspect dynamic web content or scripts, leaving developers and users to have to resort to more complicated workflows to get information that would otherwise be made available by Web Inspector. Previously, Web Inspector supported inspecting developer-provisioned apps built directly from Xcode for local development, meaning developers could debug this content so long as the app is installed for development. Web content and JavaScript is used for various purposes in apps, from providing UI from a webpage to enabling apps to be scriptable. iOS and iPadOS allow inspection of the same content as macOS, with the addition of Home Screen web apps. In Safari on macOS, you can use Web Inspector to inspect web pages, extensions, and service workers. Web Inspector is a powerful tool that allows you to debug the layout of web pages, step through JavaScript, read messages logged to the console, and more.
0 Comments
Leave a Reply. |