shyammakwana.me
shyammakwana.me

Reputation: 5752

a[download] attribute fall back for IE

Is there any fallback available for download attribute of Anchor tag to deal with IE ?

caniuse.com says it's not supported in any version if Internet Explorer.

Solution without JavaScript is preferable.

Upvotes: 0

Views: 916

Answers (1)

Abhishek Potnis
Abhishek Potnis

Reputation: 897

As of now, the download attribute is only supported in Chrome and Firefox. You could detect whether the attribute is supported using JavaScript.

var a = document.createElement('a');

if(typeof a.download != "undefined")
{
   // download attribute is supported
}
else
{
  // download attribute is not supported
}

If you are dealing with text files then you could take a look at Downloadify, which is a javascript + Flash library that enables the creation and download of text files without server interaction. Check out this Demo that uses Downloadify.

Upvotes: 4

Related Questions