From 21a26a9a72879aa38e6e12651412467fed48ca49 Mon Sep 17 00:00:00 2001
From: Paul Irish
@@ -344,76 +343,467 @@
- If started with a remote-debugging-port, these HTTP endpoints are available on the same
- port.
+ When Chromium or Chrome is launched with
+ --remote-debugging-port=<port> (for example,
+ --remote-debugging-port=9222), it starts an internal HTTP server that exposes
+ REST endpoints and WebSocket connections for target discovery, browser lifecycle
+ management, and DevTools Protocol communication.
| Endpoint | +Method | +Description | +
|---|---|---|
/json/version |
+ GET | +Browser version metadata and browser-level WebSocket URL | +
/json or /json/list |
+ GET | +List of inspectable targets (pages, workers, tabs) | +
/json/new?{url} |
+ PUT | +Create a new page or tab target (strictly requires PUT) | +
/json/activate/{targetId} |
+ GET | +Bring a target page or tab to the foreground | +
/json/close/{targetId} |
+ GET | +Close the specified target | +
/json/protocol |
+ GET | +Full DevTools Protocol JSON schema | +
/devtools/browser/{guid} |
+ WS | +Root browser-level WebSocket connection | +
/devtools/page/{targetId} |
+ WS | +Target-specific WebSocket connection | +
/json/version
+ GET /json/version
#
Browser version metadata
++ Returns browser version metadata, engine versions, and the browser-level WebSocket + debugging URL. +
+ +| Field | +Type | +Description | +
|---|---|---|
Browser |
+ string | +
+ Product name and version (e.g. Chrome/135.0.7012.0 or
+ HeadlessChrome/...)
+ |
+
Protocol-Version |
+ string | +Current supported protocol version (e.g. 1.3) |
+
User-Agent |
+ string | +Default browser User-Agent header string | +
V8-Version |
+ string | +V8 JavaScript engine version | +
WebKit-Version |
+ string | +WebKit / Blink version and Git revision hash | +
webSocketDebuggerUrl |
+ string | ++ WebSocket URL to attach to the root browser target (contains an unguessable UUID + on desktop) + | +
Android-Package |
+ string | +Host Android package ID (present on Android only) | +
{
- "Browser": "Chrome/124.0.6367.60",
- "Protocol-Version": "1.3",
- "User-Agent": "Mozilla/5.0 ...",
- "V8-Version": "12.4.254.12",
- "WebKit-Version": "537.36 ...",
- "webSocketDebuggerUrl": "ws://localhost:9222/devtools/browser/..."
+ "Browser": "Chrome/135.0.7012.0",
+ "Protocol-Version": "1.3",
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
+ "V8-Version": "13.5.100",
+ "WebKit-Version": "537.36 (@a1b2c3d4e5f60718293a4b5c6d7e8f9012345678)",
+ "webSocketDebuggerUrl": "ws://localhost:9222/devtools/browser/6b539824-7489-4a9c-9c02-4ec4dc1373ea"
}
/json or /json/list
+ GET /json or
+ /json/list
#
A list of all available websocket targets.
-
-[ {
- "description": "",
- "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/...",
- "id": "...",
- "title": "...",
- "type": "page",
- "url": "https://...",
- "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/..."
-} ]
+ + Returns an array of target descriptors for all inspectable contexts (pages, background + pages, service workers, shared workers). Targets are sorted in descending order by last + activity time. +
-/json/protocol/
- #
- The current devtools protocol, as JSON.
+Query Parameters:
+for_tab (optional flag): When present (e.g.
+ /json/list?for_tab), targets of type tab are included in the
+ results. When omitted, only frame targets are returned, and tab targets are
+ filtered out.
+
+[
+ {
+ "description": "",
+ "devtoolsFrontendUrl": "https://chrome-devtools-frontend.appspot.com/serve_rev/@a1b2c3d4/inspector.html?ws=localhost:9222/devtools/page/D598C123456789ABCDEF0123456789AB",
+ "faviconUrl": "https://example.com/favicon.ico",
+ "id": "D598C123456789ABCDEF0123456789AB",
+ "title": "Example Domain",
+ "type": "page",
+ "url": "https://example.com/",
+ "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/D598C123456789ABCDEF0123456789AB"
+ }
+]
/json/new?{url}
+ PUT /json/new or
+ PUT /json/new?{url}
#
Opens a new tab. Responds with the websocket target data for the new tab.
++ Creates a new browsing context (page or tab) navigated to the specified URL and returns + its target descriptor. +
+
+ Method Requirement: This endpoint
+ strictly requires the PUT method. Calling it with
+ GET, POST, or any other verb fails with
+ 405 Method Not Allowed ("Using unsafe HTTP verb GET to invoke /json/new. This action supports only PUT
+ verb.").
+
Query Parameters:
+& is parsed and URL-unescaped as the
+ initial navigation URL (e.g. PUT /json/new?https%3A%2F%2Fexample.com). If
+ omitted or invalid, it defaults to about:blank.
+ &for_tab flag to create a tab target instead of an
+ isolated frame.
+ /json/activate/{targetId}
+ GET
+ /json/activate/{targetId}
#
Brings a page into the foreground (activate a tab).
+Brings the specified target tab or window to the foreground.
+200 OK: "Target activated"404 Not Found: "No such target id: {targetId}"500 Internal Server Error:
+ "Could not activate target id: {targetId}"
+ /json/close/{targetId}
+ GET /json/close/{targetId}
#
Closes the target page identified by targetId.
Closes the specified target page.
+200 OK: "Target is closing"404 Not Found: "No such target id: {targetId}"500 Internal Server Error:
+ "Could not close target id: {targetId}"
+ /json/protocol
+ #
+ + Returns the complete Chrome DevTools Protocol JSON schema containing all domains, methods, + events, and type definitions. +
+ +
+ The JSON object structure returned in target lists (/json/list) and new
+ target creation (/json/new):
+
| Field | +Type | +Presence | +Description | +
|---|---|---|---|
id |
+ string | +Required | +Unique target identifier (UUIDv4) | +
parentId |
+ string | +Optional | +Target ID of the parent context (omitted for top-level pages) | +
type |
+ string | +Required | +Target classification string (see table below) | +
title |
+ string | +Required | +Document title or worker label (HTML-escaped) | +
description |
+ string | +Required | +Human-readable target description (may be empty string) | +
url |
+ string | +Required | +Current URL loaded in the target | +
faviconUrl |
+ string | +Optional | +Favicon URL (omitted if not present or invalid) | +
webSocketDebuggerUrl |
+ string | +Required | +WebSocket URL for CDP clients to attach to this target | +
devtoolsFrontendUrl |
+ string | +Required | +Complete URL to launch the hosted DevTools web inspector for this target | +
type Value |
+ Description | +
|---|---|
"page" |
+ Primary top-level web page or tab frame | +
"tab" |
+ + Tab target container (parent of all subframes and prerendered pages in a + WebContents) + | +
"iframe" |
+ Out-of-process subframe or iframe | +
"worker" |
+ Dedicated Web Worker (new Worker()) |
+
"shared_worker" |
+ Shared Web Worker (new SharedWorker()) |
+
"service_worker" |
+ Service Worker registration execution context | +
"worklet" |
+ Generic Worklet (Paint, Audio, Layout) | +
"auction_worklet" |
+ Protected Audience (FLEDGE) Auction Worklet | +
"browser" |
+ Browser-wide process target | +
"webview" |
+ Guest view or <webview> content |
+
"background_page" |
+ Chrome Extension background page or offscreen document | +
"app" |
+ Packaged app, platform app, or Isolated Web App (IWA) | +
"browser_ui" |
+ Internal Chrome WebUI window or contents | +
"other" |
+ Fallback classification for other inspectable targets | +
/devtools/page/{targetId}
+ WebSocket
+ /devtools/page/{targetId} & /devtools/browser/{guid}
#
The WebSocket endpoint for the protocol.
++ Clients communicate with the DevTools Protocol over full-duplex WebSocket connections. +
+/devtools/page/{targetId}): Attaches
+ directly to a single target session. If the target crashes or is closed, the server
+ emits an unprompted CDP notification before closing the socket:
+ {"method":"Inspector.detached","params":{"reason":"target_closed"}}
+ /devtools/browser/{guid}): Attaches to
+ the root browser session, enabling target auto-discovery, multi-target attachment via
+ Target.attachToTarget, and browser-wide management. On desktop Chrome, the
+ path contains an unguessable UUIDv4 written to the DevToolsActivePort file
+ in the user data profile directory.
+ /devtools/inspector.html
+ GET /devtools/inspector.html
#
A copy of the DevTools frontend that ships with Chrome.
+
+ Legacy endpoint serving the bundled DevTools frontend. In modern Chrome, inspect targets
+ using the remote frontend URL provided in target descriptors (devtoolsFrontendUrl).
+
Host header. It must either be an IP address
+ (e.g. 127.0.0.1, [::1]) or localhost. Other
+ hostnames trigger an immediate 500 Internal Server Error ("Host header is specified and is not an IP address or localhost.").
+ --remote-allow-origins):
+ When a WebSocket handshake includes an Origin header (such as from a web
+ page), the origin must match the origins specified via
+ --remote-allow-origins=<origin> (or
+ --remote-allow-origins=*). Non-matching origins receive
+ 403 Forbidden. Requests without an Origin header (such as CLI
+ tools, Puppeteer, Node.js) are allowed by default.
+ Access-Control-Allow-Origin response headers, ensuring the browser
+ Same-Origin Policy prevents arbitrary websites from reading target lists or metadata via
+ fetch() or XMLHttpRequest.
+ /json/* endpoints emit
+ Content-Security-Policy: frame-ancestors 'none', and the discovery page
+ (/) emits X-Frame-Options: DENY.
+