Download Extension
The Download extension adds a button that allows users to download the currently viewed high-resolution image.
Installation
Section titled “Installation”ESM (Module Bundlers)
Section titled “ESM (Module Bundlers)”UMD (CDN)
Section titled “UMD (CDN)”Features
Section titled “Features”- Download button - Adds a download control to the lightbox
- Automatic filename - Uses the image’s alt text as the download filename
- Loading state - Shows a pulsing animation while downloading
- Cross-origin support - Handles CORS-protected images via fetch
The download button appears in the control area you specify. When clicked, it:
- Fetches the high-resolution image
- Creates a blob URL
- Triggers a download with the image’s alt text as the filename
- Cleans up the temporary blob URL
Customization
Section titled “Customization”Control Position
Section titled “Control Position”Styling
Section titled “Styling”The download button uses the standard VistaView control styling and can be customized with CSS:
Bundle Size
Section titled “Bundle Size”- ESM: 1.42 KB (0.70 KB gzip)
- UMD: 1.41 KB (0.79 KB gzip)
Browser Compatibility
Section titled “Browser Compatibility”Works in all modern browsers that support:
- Fetch API
- Blob URLs
- Download attribute on anchor elements
For older browsers, consider using a polyfill or the extension will gracefully fail.
Example
Section titled “Example”When users click the download button, the image will be saved with the filename based on the alt text (e.g., “Beautiful Sunset.jpg”).
Next Steps
Section titled “Next Steps”- Explore other extensions
- Learn about creating custom extensions
- See the configuration options