jeff-h
jeff-h

Reputation: 2639

Accessing Safari Web Inspector backend server from Swift / WkWebView

Using Safari's Web Inspector, it's possible to inspect and debug websites remotely.

The Web Inspector is a multi-tier application. It’s divided into 3 layers: a frontend, a backend and a target.

—from Architecture of the Web Inspector

In other words, the WkWebView runs a server that can provide Web Inspector information as raw data. The Web Inspector UI is a JavaScript application that works with this raw data.

I can enable the Web Inspector inside a WkWebView using developerExtrasEnabled but what I want to do is slightly different. I want to access the backend server from Swift. I want my Swift code to get access to the same raw data that the Web Inpector UI front-end works with.

Is it possible, and if so, can anyone point me in the direction of how?

And where is the data protocol documented?

Upvotes: 1

Views: 501

Answers (1)

jeff-h
jeff-h

Reputation: 2639

I spoke with a member of Apple's webkit team who told me this currently isn't possible — there's no public API implemented that provides access to this data. I've put in a radar issue describing this feature request.

Upvotes: 1

Related Questions