Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dwnld-attr-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dwnld-attr-polyfill

Polyfills the a[download] attribute

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

download-attribute-polyfill

Will polyfill the functionality of:

                          ↓ ↓ ↓
<a href="/somefile.pdf" download>
    Download this (don't navigate to it)
</a>

in IE11, which doesn't support it. This polyfill is small and works fast.

Usage

Install using npm:

npm i -S download-attribute-polyfill

And include it in your JavaScript somewhere:

import 'download-attribute-polyfill';

This polyfill automatically does its work. It will:

  1. Detect if polyfilling is needed (and otherwise won't do anything)
  2. Detect on click if it's on a link with the download attribute
  3. Prevent their default behaviour
  4. Via an XMLHttpRequest, request the resource and create a blob of data
  5. Instruct IE11 to download that data using msSaveBlob

FAQs

Package last updated on 10 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc