javascript - Remove or disable attribute download -


i have tag download attribute:

<a href="#" id="dl-btn" download>click download</a> 

then depending if download available in script set values:

if(download_exist)$('#dl-btn').attr('href', path).prop('download', true); else $('#dl-btn').attr('href', '#').prop('download', 'disabled'); 

but still downloads html page (like index.html)

i tried:

$('#dl-btn').attr('href', '#').removeprop('download');  $('#dl-btn').attr('href', '#').prop('download', false); 

nothing seems preventing trigger download (at least in chrome)

use removeattr removeattr('download');


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -