Web API labs

Web API labs you can run in the tab: Notification, getUserMedia, View Transitions, File System Access, EyeDropper, and more. Methods, a stage, no backend.

CSS

  • CSS overflow carousel example — CSS carousel example with overflow, ::scroll-button, and ::scroll-marker. The browser paints the controls. No slider library.
  • CSS Anchor Positioning example — CSS Anchor Positioning example. Name an element with anchor-name, then position another against it. Tooltips and menus without JS coordinates.
  • Customizable select example — Customizable select example with appearance: base-select. Native picker, options that can hold images, styled in CSS.
  • CSS Custom Highlight API example — CSS Custom Highlight API example. Paint a Range with HighlightRegistry and ::highlight(). No extra DOM spans.
  • View Transitions API example — View Transitions API example. document.startViewTransition() names an element and the browser animates the DOM update.
  • CSS Container Queries example — CSS container queries example. @container watches the component box, not the viewport. compact, split, and open from the same markup.

Media

  • HTML usermedia element example — HTML usermedia, camera, and microphone elements. The browser draws the permission control and returns the stream. An alternative to getUserMedia().
  • MediaRecorder API example — MediaRecorder API example. Record a MediaStream with a chosen codec, then download the Blob. A stream is not a file.
  • Web Audio API example — Web Audio API visualizer. AnalyserNode FFT from the microphone, drawn on canvas. Frequency data the audio element will not give you.
  • Web Speech API example — Web Speech API example. SpeechRecognition in, speechSynthesis out. A transcript, then a spoken string. No assistant object.
  • Document Picture-in-Picture API example — Document Picture-in-Picture API example. documentPictureInPicture.requestWindow() floats a document, not a video.
  • ImageCapture API example — ImageCapture API example. grabFrame(), drawImage(), and createImageBitmap() from the same camera. Six grabs, timed.
  • MediaDevices API example — MediaDevices API example: getSupportedConstraints(), enumerateDevices(), getUserMedia(), getDisplayMedia(), selectAudioOutput(), devicechange.

Platform

  • Notifications API example — Notifications API example: Notification.permission, requestPermission(), new Notification(), tag, events, and close(). Run it in the tab.
  • Sanitizer API example — Sanitizer API example. setHTML() filters untrusted HTML in the browser so you do not assign a string to innerHTML.
  • EyeDropper API example — EyeDropper API example. EyeDropper.open() reads a pixel from the screen after a gesture and returns sRGBHex.
  • Translator API example — Translator API example. On-device language translation in the browser with Translator.create(). The model stays on the machine.
  • OffscreenCanvas API example — OffscreenCanvas API example. transferControlToOffscreen() moves canvas painting off the main thread so the page stays responsive.
  • File System Access API example — File System Access API example. showOpenFilePicker() returns a handle. Read and write the real file. Not an upload.

Vision

  • BarcodeDetector API example — BarcodeDetector API example. Detect QR codes and barcodes from a camera frame with the OS shape-detection stack.
  • Face Landmarker example — Face Landmarker example in the browser. MediaPipe reads 478 face points from the camera and draws them live.
  • Gesture recognition example — Hand gesture recognition in the tab. MediaPipe classifies a wave, a fist, and other poses from the camera.