# Clipboard Inspector

> 這個分頁列出剪貼簿裡每一種 MIME：text/plain、text/html 原文、image/png、廠商格式。HTML 當純文字看。全程在你電腦裡，不上傳、不記錄，離開就沒了。

- URL: https://bytescope.dev/zh-Hant/clipboard-inspector/
- Locale: zh-Hant · Also: [en](https://bytescope.dev/en/clipboard-inspector.md) · [ja](https://bytescope.dev/ja/clipboard-inspector.md)
- Runs: 不上傳、不記錄。讀到的內容只留在這個分頁，離開就沒了。
- Requires: Any modern browser. How many clipboard formats a page may see differs per browser and the page reports exactly what it received.
- Updated: 2026-09-08

## What it does

這一頁要答的，是開發者真的會打的那句：我的剪貼簿裡到底有什麼？不是猜的。你點下去之後，它會問 `navigator.clipboard.read()`，把瀏覽器肯給的 MIME 全部列出來——`text/plain`、`text/html`、`text/uri-list`、`image/png`、`image/svg+xml`，還有 `web application/x-vnd…` 這種廠商自己的格式。一列就是一種型別、大小（bytes）、再加上適合那種型別的看法。不會上傳、不會留下紀錄，離開這個分頁就沒了。

### 不是一個文字框，是每種 MIME

貼進表單時，表單只會留下它要的那種。剪貼簿本身常常同時放著同一份內容的好幾種寫法。這一頁每種都列。hex 跟 hex editor 同一套說法：offset、16 bytes 一列、右邊 ASCII。圖片會顯示型別和大小；`createImageBitmap` 讀得懂才會給像素尺寸。某一個型別的 `getType()` reject 了，那格標 unavailable，其他格照常出。

### 最有價值的是 HTML 原文

從 Word 或 Notion 貼過來，偷偷跟來的常常是 `text/html`——一堆 inline style、`mso-`、被轉過的列表。這一頁把那段原文當文字顯示，先逸出過，所以不會變成 DOM。沒有 `dangerouslySetInnerHTML`，沒有 `eval`，不會寫進頁面。你只想看字的話看 `text/plain` 那列；HTML 那列是在解釋「為什麼貼上去會長那樣」。

### 被拒絕不是空的，unknown 也不是 denied

`clipboard.read()` 一定要從點擊或貼上來。這一頁不會在載入時自己讀。`NotAllowedError` 代表瀏覽器拒絕了，或還在等你做一個手勢——不是剪貼簿是空的。空的是另一種結果。`navigator.permissions.query({ name: "clipboard-read" })` 在很多瀏覽器會 throw；throw 就顯示 `unknown`，不會寫成 `denied`。有些瀏覽器只實作 `readText()`。那種情況會寫「這個瀏覽器只回報純文字」，不會說「剪貼簿裡只有純文字」。

### 兩條路，因為它們會不一樣

Async Clipboard API 跟 `paste` 事件的 `clipboardData.items` 不是同一條管。Chrome 可能在 `read()` 時清過 HTML，另外留一個 `web text/html`；貼上事件看得到的型別，`read()` 不一定有，反過來也是。這一頁的貼上區是拿來對照的，不是第二個玩具。兩邊的結果都只留在這個分頁，離開就沒了。

## Limits

Does not show clipboard history or watch the clipboard in the background; it inspects what you paste or read on demand.

## Machine output

Copy JSON copies an envelope `{ tool, url, generatedAt, userAgentHint, result }`. `tool` is `"clipboard-inspector"`; `result` is shape only — MIME types, byte lengths, item counts, image pixel size. Clipboard payload is omitted.

- `clipboardRead` (boolean | null) — `null` = not probed yet; `false` = probed, `navigator.clipboard.read` missing; `true` = present.
- `clipboardReadText` (boolean | null) — `null` = not probed yet; `false` = probed, `readText` missing; `true` = present.
- `permission` (string | null) — `"granted"` | `"denied"` | `"prompt"` | `"unknown"`. `null` = permission query not asked.
- `asyncSnapshot` (object | null) — Async Clipboard `read()` / `readText()` snapshot. `null` = no successful read. When present: `source` (`"read"` | `"readText"`), `textOnly`, `itemCount`, `items` (each item has `types`: mimeType, kind, unsanitized, byteLength, imageWidth, imageHeight). `byteLength` is `null` when that flavour was listed but not read; image dimensions are `null` when kind is not image or size did not load.
- `pasteSnapshot` (object | null) — `paste` event snapshot. `null` = no successful paste. Same inner shape as `asyncSnapshot`, with `source` `"paste"`.

## FAQ

### 會上傳或留下我剪貼簿裡的東西嗎？

不會。這些內容不會離開這個分頁。沒有打到伺服器、沒有把內容送進分析、沒有紀錄。關掉或跳走，這次讀到的就沒了。頁面上那句隱私說明就是全部政策。

### 為什麼一定要點？不能自動讀嗎？

Async Clipboard API 本來就要求使用者手勢。就算沒有這條限制，這一頁也不會自動讀。剪貼簿裡常是秘密：密碼、token、還沒送出的信。點下去才是同意。貼上區則是另一種同意——你自己貼的。

### 我點了，它說 permission denied。所以是空的？

不是。`NotAllowedError` 是被拒絕（或還缺一個手勢），不是空的。空的是另一件事：`read()` 回來沒有項目，或瀏覽器丟 `NotFoundError`。這一頁不會把兩種結果說成同一句「沒有內容」。

### 貼上區跟讀取按鈕看到的型別不一樣。哪邊才算數？

兩邊對自己的 API 都算數。`navigator.clipboard.read()` 跟 `event.clipboardData` 是不同路徑，瀏覽器清過的程度也不一樣，尤其是 `text/html`。不一樣本身就是資訊。這一頁不會把其中一邊改寫成另一邊。

### 這個瀏覽器只顯示 text/plain。是複製的時候就只有這個嗎？

不一定。有些瀏覽器只提供 `clipboard.readText()`，只回 Unicode 文字，其他 MIME 根本看不到。這一頁會用這句話講清楚。在沒問過其他格式的情況下，不會說「剪貼簿裡只有純文字」。

### 在這裡看剪貼簿裡的 HTML 安全嗎？

HTML 會逸出後以純文字顯示。不會解析成元素、不會當腳本跑、不會寫進 `innerHTML`。就算這樣，還是把它當不受信任的輸入。這是檢視器，不是把那頁畫出來給你看。

## Related tools

- [Hex Viewer / Editor](https://bytescope.dev/zh-Hant/hex-editor.md) — 同一套 offset／16 bytes／ASCII，拿來看檔案而不是剪貼簿。
- [File Type Identifier](https://bytescope.dev/zh-Hant/file-type.md) — 二進位那格看不懂？用 magic bytes 認它到底是什麼。
- [Image ↔ Base64 Converter](https://bytescope.dev/zh-Hant/image-base64.md) — 把剪貼簿裡的 PNG 轉成 data URI，或倒過來。
