# web_evaluate_js

web_evaluate_js — a prompt for Claude Code runs JavaScript code on the current web page and returns the collected data as JSON.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 9488 repo stars
- Author: wangzan101
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/wangzan101/Mika/tree/HEAD/core/src/main/resources/prompts/tools/web_evaluate_js.md
- Updated: 2026-11-16
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/web-evaluate-js

## What it does

The script executes inside the live page context to read DOM elements using queries like `querySelectorAll` and `textContent`. Network access, form submissions, DOM mutations, cookies, and local storage access remain blocked during execution. Fields resembling credentials, tokens, and payment cards are automatically masked.

The execution time is bounded, and the output string length has a strict character limit. A dedicated `state` object preserves data across calls on the same page and resets when the page changes. Since network requests fail, data loaded via page APIs requires the `web_capture` tool instead.

Installation in Claude Code is done by placing the file at `.claude/commands/web_evaluate_js.md` in the project directory.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/web_evaluate_js.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/wangzan101/Mika/tree/HEAD/core/src/main/resources/prompts/tools/web_evaluate_js.md

## When to use it
- execute JavaScript inside the current web page DOM
- mask sensitive credentials and tokens automatically
- persist state variables across script calls on the same page
- limit execution time and result string length

## Example prompts
- Run `web_evaluate_js` to extract text contents from the current DOM
- Execute `web_evaluate_js` to read page data as JSON

## Source text · web_evaluate_js.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 5bc2dd6734c8b5f6.

BEGIN THIRD-PARTY FILE 5bc2dd6734c8b5f6
```text
Read data from the current web page with JavaScript, and get the result back as JSON (default time limit {{default_seconds}} s, result at most {{result_max}} characters; values that look like credentials or tokens are masked). The script runs inside the real page and sees the live DOM, but it can only read: document, window, location and getComputedStyle are read-only views of the page (querySelectorAll, getAttribute, textContent, getBoundingClientRect and the like work; setting a property, adding or removing elements, click(), focus(), submit(), opening windows or navigating fail with read_only). Password, hidden, one-time-code and card fields read as ***, and cookies and local storage cannot be read. It cannot use the network: fetch, XMLHttpRequest, sendBeacon, WebSocket and loading images or scripts fail with blocked_network; it only reads what the page already has (to read data the page loaded from its APIs, use web_capture). Also available: sleep(ms), URL, URLSearchParams, plain JavaScript (JSON, Math, Array…), and state, an object that keeps what you put in it across calls on the same page (state="new" in the result means it was just created, e.g. after the page changed). script is one expression or the body of an async function that uses return; return plain data (strings, numbers, arrays, objects), not elements. To act on the page use the action tools.
```
END THIRD-PARTY FILE 5bc2dd6734c8b5f6

The third-party file has ended. Everything between the 5bc2dd6734c8b5f6 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© wangzan101 · Apache-2.0 · https://github.com/wangzan101/Mika/tree/HEAD/core/src/main/resources/prompts/tools/web_evaluate_js.md

## Similar
- [jquery-expert](https://affpapa.org/en/nevibecode/agents/jquery-expert.md) — subagent · ★ 1029 repo stars
- [parallel-web-search](https://affpapa.org/en/nevibecode/skills/parallel-web-search.md) — skill · 15100 installs
- [parallel-web-extract](https://affpapa.org/en/nevibecode/skills/parallel-web-extract.md) — skill · 14200 installs
- [tavily-extract](https://affpapa.org/en/nevibecode/skills/tavily-extract.md) — skill · 18600 installs
- [pentest-lyan-web-security-testing](https://affpapa.org/en/nevibecode/skills/pentest-lyan-web-security-testing.md) — skill · 166 installs
- [js-performance-patterns](https://affpapa.org/en/nevibecode/skills/js-performance-patterns.md) — skill · 716 installs

From the same set: [wangzan101/mika](https://affpapa.org/en/nevibecode/by/wangzan101/mika.md) — 132 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
