I have a tag with download attribute:
<a href="#" id="dl-btn" download>click to download</a>
then depending if the download is available in the script I set values:
if(download_exist)$('#dl-btn').attr('href', path).prop('download', true);
else $('#dl-btn').attr('href', '#').prop('download', 'disabled');
but it still downloads html page (like index.html)
I tried:
$('#dl-btn').attr('href', '#').removeProp('download');
$('#dl-btn').attr('href', '#').prop('download', false);
Nothing seems to preventing it trigger download (at least in chrome)