'Problem dowloading a pdf file through browser using javascript

I have to present for an exam a portfolio which allows visitors to download some documentations about my projects as pdf files.

I tried using an tag with a "download" attribute, unfortunately when I try to download the file by clicking on the link, the file is proposed to be recorded as .html or all files.

Whatever option I choose, after downloading the file, I'm not able to open it because it seems damaged or in the wrong format.

enter image description here

Here's the code I use :

enter image description here

My "demo" var is contained in an object Work as you can see on the screenshot :

enter image description here

In case it matters, my pdf file is stored here:

enter image description here

Thanks for you help ! =)



Solution 1:[1]

As a wild guess :

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 schiffsratte