How to detect support for the HTML5 “download” attribute?

Use the Modernizr approach: create the element, and check if the attribute is defined:

var a = document.createElement('a');
if (typeof a.download != "undefined") {
    alert('has support');
}

Leave a Comment