diedVIPs

html knowhow

Bild herunterladen










Bild herunterladen

So sieht´s aus

life

Quellcode
<html>
<head>

<style type="text/css">Hier nichts</style>
</head>

<body>
<img alt="life" src="../Bilder/Life.jpg" style="height: auto" width="10%" /><br/>
<button onclick="download()">Bild herunterladen</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js"></script>
<script>
function download() {
axios({
url: 'http://htmlknowhow.de/Bilder/Life.jpg',
method: 'GET',
responseType: 'blob'
})
.then((response) => {
const url = window.URL
.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', '../Bilder/Life.jpg');
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
}
</script>

</body>
</html>








Kontakt    Datenschutz   Impressum