Skip to main content

Lesson 7 of 9

Clipboard & Fullscreen APIs

Modern browser APIs provide programmatic access to the clipboard (copy/paste) and fullscreen mode. The Clipboard API replaces the deprecated document.execCommand('copy') with a clean promise-based interface. The Fullscreen API lets any element (not just the page) go fullscreen - perfect for videos, games, and presentations.

10 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Clipboard & Fullscreen

  • navigator.clipboard.writeText('text') - Copies text to clipboard. Returns a Promise. Requires HTTPS.
  • navigator.clipboard.readText() - Reads clipboard content. Requires explicit user permission.
  • element.requestFullscreen() - Makes any element fullscreen. Works on <video>, <canvas>, <div>, etc.
  • document.exitFullscreen() - Exits fullscreen mode.
  • document.fullscreenElement - Returns the element currently in fullscreen, or null.
  • :fullscreen CSS pseudo-class - Style elements differently when in fullscreen mode.
  • Copy button pattern: <button onclick="navigator.clipboard.writeText(code.textContent)">๐Ÿ“‹ Copy</button>
Diagram
Loading diagramโ€ฆ

Modern browser APIs provide native copy-paste and full-screen presentation modes

Key Takeaways

  • Modern browser APIs provide programmatic access to the clipboard (copy/paste) and fullscreen mode.
  • navigator.clipboard.writeText('text') - Copies text to clipboard. Returns a Promise. Requires HTTPS.
  • navigator.clipboard.readText() - Reads clipboard content. Requires explicit user permission.
  • element.requestFullscreen() - Makes any element fullscreen. Works on <video>, <canvas>, <div>, etc.

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/9 done