How to detect Claude in Chrome and other AI browser agents
isagent is a JavaScript library that detects AI browser agents operating on a web page, and records which form fields they filled. It identifies Claude in Chrome specifically. Other agents that control the browser through the Chrome DevTools Protocol, such as Puppeteer or Playwright scripts, Browser Use and ChatGPT agent, are detected from generic signals.
It runs entirely in the page, has no dependencies, and is about 7 KB gzipped. It is MIT licensed.
Installation
From a CDN, in <head> before other scripts:
<script src="https://cdn.jsdelivr.net/npm/isagent.js@1/dist/isagent.min.js"></script>
Or from npm:
npm install isagent.js
The script only observes what happens after it loads, so load it early.
Usage
const detector = isagent.start({ formField: "agent_detection" });
if (isagent.isAgent()) {
// an AI browser agent is operating, or has operated, on this page
}
With a bundler:
import { start, isAgent } from "isagent.js";
const detector = start({
formField: "agent_detection",
onDetect: (report) => console.log("agent detected:", report.agent),
});
With formField set, a field holding the result is added to every form submission. See Which fields were filled.
Detecting Claude in Chrome
Claude in Chrome is a Chrome extension that lets Claude read pages, click, type and fill in forms in the user's browser. It can be detected from JavaScript in the page by three kinds of evidence, described below. The details apply to version 1.0.107 of the extension (November 2026).
Server-side detection
Claude in Chrome can't be detected from the server. It runs inside the visitor's own Chrome, so requests carry their usual user agent, cookies and IP address, and the extension adds no header. User-agent lists such as isbot don't match it.
Overlay element
While Claude works on a tab, the extension shows a glow around the page, its own cursor, a status tag and a Stop button. These are drawn inside a closed shadow root attached to a <div> that the extension appends to <body>. The page can't see inside the shadow root, but the host element has a recognisable shape:
- it has no attributes and no child nodes;
- its computed
displayiscontents; attachShadow()throwsNotSupportedErroron it, because a shadow root already exists.
The element is not removed when Claude finishes. While Claude is active, the Stop button and tag receive pointer events, so document.elementsFromPoint() at their positions returns the host element. isagent uses this to report whether Claude is active right now (report.active).
Earlier versions placed these elements directly in the page, and some articles suggest querying #claude-agent-stop-container, #claude-agent-glow-border or #claude-agent-animation-styles. Those queries return nothing on current versions. isagent still checks them for older installs.
form_input tool
Claude fills most fields with a tool called form_input. It sets the field's value property, focuses the field, and then dispatches two untrusted events in the same task: change, then input. Typing, pasting, browser autofill and ordinary scripts produce input before change, so the order identifies the tool and the field it filled. Checkboxes and radio buttons are toggled by calling click(), which produces an untrusted click event.
The events are not composed, so for fields inside a shadow root they never reach window. isagent listens on the shadow root as well, using the focusin event that precedes them.
Keystrokes and clicks
When Claude types with its computer tool, it sends key-down and key-up events through the DevTools Protocol for every character at once. The events are trusted, but each key is held for under about 10 ms with no gap between keys. People hold keys for tens of milliseconds. isagent flags two or more consecutive keys like this.
Clicks are sent as a single pointer move straight to the target, a pause of about 100 ms, then a press and release a few milliseconds apart. There is no movement trail.
Durations should be measured with each event's timeStamp. If they are measured when the handler runs, a person's key-down and key-up can be delayed by a busy main thread and handled back to back, which looks like a machine.
Other AI browser agents
Agents that drive the browser through the DevTools Protocol or WebDriver share the timing signals above. isagent also checks:
navigator.webdriverand global variables left by ChromeDriver (cdc_…), Playwright, Selenium and Puppeteer;- DOM markers publicly reported for ChatGPT agent, Browser Use and Playwright's inspector (not independently verified);
- fields changed by script-dispatched events with no user input, and values present at submission that never came from user input;
- clicks that repeatedly land on the exact centre of their targets.
When these signals are present without Claude-specific evidence, report.agent is "unknown", or the named agent if a marker matched.
Which fields were filled
Each field an agent filled is recorded with the method used. detector.summary(form) returns, and the formField option submits, a JSON object like this:
{
"v": "1.0.0",
"verdict": "agent",
"agent": "claude-in-chrome",
"active": true,
"score": 0.999,
"claude": 0.999,
"signals": ["overlay-host:1", "form-input:2", "synthetic-typing:1"],
"fields": [
"input#email[name=\"email\"]:form_input",
"textarea#message[name=\"message\"]:synthetic-typing"
]
}
The field is added through the formdata event, so it is included in normal submissions, form.submit(), and fetch requests that use new FormData(form). Field values are not included. For JSON APIs, add detector.summary(form) to the request body.
| Method | Meaning |
|---|---|
form_input | Set by Claude in Chrome's form_input tool |
synthetic-typing | Typed with machine timing |
insert-text | Inserted without key presses (DevTools Input.insertText) |
programmatic-click | Checkbox or radio toggled by script |
synthetic-event | Changed through script-dispatched events |
no-user-input | Had a value at submission that never came from user input |
Handling results
The result is produced in the visitor's browser, so treat it as evidence rather than proof. It can be removed or altered, and a missing result means nothing.
const result = JSON.parse(req.body.agent_detection || "{}");
if (result.verdict === "agent") {
// for example: ask for confirmation, send a verification email,
// or queue the submission for review
}
verdict is "agent" when the combined score reaches the threshold (0.85 by default), "suspected" from 0.5, and otherwise "none".
Blocking agents
isagent can tell you that Claude in Chrome or another agent filled a form, but it is not a reliable way to block one, because it runs on the client. Blocking is also often unwanted: many people use these agents deliberately, and the generic signals can be triggered by on-screen keyboards, voice input or password managers. Common responses are a confirmation step for agent-filled fields, rate limits on sensitive actions, or reviewing those submissions.
Limitations
- Reading a page, taking accessibility snapshots and taking screenshots leave no trace in the page.
- Claude in Chrome enables focus emulation, which makes a background tab report itself as visible and focused. Tab visibility can't be used as a signal.
- Cross-origin iframes need their own copy of the script. Same-origin iframes are watched automatically.
- The signals depend on the current behaviour of each agent and may change with new versions.
API
| Function | Description |
|---|---|
isagent.isAgent() | true if an agent is or was operating on the page |
isagent.start(options) | Start a detector and return it |
detector.report() | Full report: verdict, agent, active, scores, signals, filled fields |
detector.summary(scope) | Compact JSON for a server, limited to fields inside scope |
detector.agentFill(element) | How an agent filled element, or null |
detector.stop() | Remove all listeners |
Options include formField, threshold, and the callbacks onDetect, onSignal, onFieldFill and onActiveChange. The full list of options and signals is in the README. TypeScript definitions are included.
Questions
Can a website detect Claude in Chrome?
Yes, from JavaScript in the page, as described in Detecting Claude in Chrome. Not from the server.
Does Claude in Chrome have its own user agent?
No. It uses the visitor's Chrome user agent unchanged.
Does it detect ChatGPT agent, Comet or other AI browsers?
Not by name, except through the published markers listed under Other AI browser agents. Agents that type and click through the DevTools Protocol are detected from their timing.
How can I test it?
Open the demo page and ask Claude in Chrome to fill in the form, or run the test suite, which replays each behaviour in Chrome.