Automate clipboard read/write both at the OS level and inside a browser page, accounting for per-OS and per-browser permission differences

domain: developer.mozilla.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. For in-page clipboard access, grant the clipboard-read/clipboard-write permissions when creating the browser context (Playwright's use.permissions, or Puppeteer's context.overridePermissions()) before calling navigator.clipboard from page.evaluate()
  2. Expect Chromium to support these permissions most reliably; WebKit has limited/partial clipboard permission support and Firefox handles clipboard permissions differently, so cross-browser clipboard tests need per-browser handling
  3. For native OS-level clipboard access outside the browser sandbox, use the platform tool: pbcopy/pbpaste on macOS, clip.exe or PowerShell's clipboard cmdlets on Windows, and xclip/xsel (X11) or wl-copy/wl-paste (Wayland) on Linux
  4. Match the clipboard format explicitly when it matters — plain text, HTML, and image data are separate clipboard representations, and most CLI tools default to plain text unless told otherwise
  5. Prefer testing clipboard operations in headed or virtual-display mode when feasible, since some Clipboard API paths behave inconsistently in fully headless browser contexts

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans