How can a web browser begin playing a 500 MB 4K video within milliseconds of a drag-and-drop gesture—and why does the generated blob:https://... address look like a web URL even though nothing was uploaded? Understanding the W3C File API's zero-copy Blob URL store and Same-Origin security boundary answers both questions.
1. Browser Sandboxing & User-Mediated File Handles
Web JavaScript executes inside an isolated OS sandbox with zero arbitrary filesystem access; scripts can never scan directories on their own. Only when a user performs an explicit gesture—selecting files via <input type="file"> or dropping items onto a drop target—does the browser mint read-only File handles scoped strictly to those chosen files.
2. Base64 FileReader vs. Zero-Copy URL.createObjectURL() Pointers
Developers have two ways to feed a local File into an <img> or <video> element, with drastically different memory characteristics:
| Metric | FileReader.readAsDataURL() | URL.createObjectURL() (Tile Viewer) |
|---|---|---|
| Output Representation | data:video/mp4;base64,AAAAIG... (massive string) | blob:https://tile-viewer-web.com/550e8400... (UUID) |
| Memory Overhead | ~133% Base64 inflation inside JS string heap | Zero inflation (lightweight pointer handle) |
| Creation Latency (500 MB clip) | Multi-second UI freeze or V8 string-limit crash | < 1 ms O(1) descriptor registration |
| Video Seeking & Streaming | Must buffer entire file into memory upfront | Streams byte ranges on demand from local disk |
3. Same-Origin Isolation & Process Scoping of blob: URLs
- Local Browser Process Only: Sharing a
blob:URL string with another computer—or even pasting it into a different browser on the same machine—returnsERR_FILE_NOT_FOUND. - Strict Origin Binding: The embedded origin ensures no external website tab can dereference pointers created inside your Tile Viewer session.
- Automatic Tab Teardown: Closing or refreshing the browser tab immediately purges the entire document Blob URL table.
4. Deterministic Memory Cleanup with URL.revokeObjectURL()
Because the browser cannot guess when a script is finished using a blob: URL during a single-page session, JavaScript garbage collection will not free the underlying file reference automatically. Tile Viewer explicitly invokes URL.revokeObjectURL(url) whenever you remove an individual card, clear the workspace, or unmount the view—keeping long curation sessions lean and responsive.