The browser is under remote control reason DevTools is a fascinating topic.
In many cases, the browser is under remote control due to a security feature called CORS, or Cross-Origin Resource Sharing.
This feature restricts web pages from making requests to a different domain than the one the web page was loaded from, to prevent malicious scripts from making unauthorized requests on behalf of the user.
As a result, some web applications may use a proxy server to circumvent this restriction, effectively putting the browser under remote control.
DevTools can help you identify and diagnose issues related to CORS and proxy servers.
How DevTools is Controlled Remotely
To control DevTools remotely, you can use the DevTools protocol via a Chrome extension. This allows you to interact with the protocol and attach to a remotely running Chrome instance.
The Chrome Debugger Extension API provides a higher level API that hides request ids and handles binding of the request with its response. This makes it easier to use the API and report results in a callback function call.
If this caught your attention, see: Chrome Devtools Replay Request
You can use this API in combination with other Extension APIs to develop a Web-based IDE. With this API, your IDE can open pages with the target application, set breakpoints, evaluate expressions in the console, and more.
Opening embedded Developer Tools will terminate the remote connection and detach the extension. This means you'll lose access to the remote Chrome instance.
See what others are reading: Redux Devtools Extension
HTTP Endpoints for Remote Control
HTTP Endpoints for Remote Control are available on the same port as the remote-debugging-port.
If you start a browser with a remote-debugging-port, you can access these endpoints to exercise remote control over the browser.
HTTP Endpoints are a key part of remote debugging, allowing you to interact with the browser in real-time.
These endpoints are available on the same port as the remote-debugging-port, making it easy to access them.
You might like: Looker Studio Access Control
WebSocket Connection for Remote Control
The WebSocket connection is a crucial part of remote controlling a browser with DevTools. The WebSocket endpoint for the protocol is /devtools/page/{targetId}.
To establish a WebSocket connection, you can use the chrome.debugger extension API, which exposes a JSON message transport interface. This API allows you to attach to a remotely running Chrome instance and instrument it from its own extension.
The chrome.debugger extension API provides a higher level API where command domain, name, and body are provided explicitly in the sendCommand call. This API hides request ids and handles binding of the request with its response, allowing sendCommand to report results in the callback function call.
Monitoring the Protocol
Monitoring the protocol is a great way to see how the DevTools frontend uses the protocol. You can view all requests/responses and methods as they happen.
To do this, click the gear icon in the top-right of the DevTools to open the Settings panel. Select Experiments on the left of settings and turn on "Protocol Monitor", then close and reopen DevTools.
Now, click the ⋮ menu icon, choose More Tools and then select Protocol monitor. You can also issue your own commands using Protocol Monitor. If the command doesn't require any parameters, type the command into the prompt at the bottom of the Protocol Monitor panel and press Enter.
Readers also liked: Unlock Samsung Oven Control Panel
WebSocket /devtools/page/{targetId}
The WebSocket /devtools/page/{targetId} endpoint is the protocol's WebSocket endpoint.
This endpoint allows for a remote connection to a Chrome instance, enabling you to interact with it programmatically.
By using this endpoint, you can attach to a remotely running Chrome instance and even instrument it from its own extension.
The Chrome Debugger Extension API provides a higher level API that exposes a JSON message transport interface, making it easier to interact with the protocol.
This API hides request IDs and handles binding of the request with its response, allowing you to report results in a callback function call.
You can use this API in combination with other Extension APIs to develop a Web-based IDE that exposes debugging capabilities to your page.
With this API, your IDE will be able to open pages with the target application, set breakpoints, evaluate expressions in the console, live edit JavaScript and CSS, and display live DOM.
See what others are reading: Chrome Devtools Protocol
Sources
- https://chromedevtools.github.io/devtools-protocol/
- https://kinsta.com/knowledgebase/err_ssl_version_or_cipher_mismatch/
- https://developer.chrome.com/blog/new-in-devtools-100
- https://docs.expo.dev/more/expo-cli/
- https://stackoverflow.com/questions/64816044/how-to-solve-selenium-firefox-browser-is-under-remote-control
Featured Images: pexels.com