document.getElementById('mp3-download-link').addEventListener('click', async function (event) { event.preventDefault(); const button = event.currentTarget; const fileUrl = '/wp-content/uploads/2026/05/EINSCHLAF-MEDITATION-19.05.26.mp3'; const fileName = 'EINSCHLAF-MEDITATION-19.05.26.mp3'; button.textContent = 'Download wird vorbereitet …'; try { const response = await fetch(fileUrl); if (!response.ok) { throw new Error('Datei konnte nicht geladen werden.'); } const blob = await response.blob(); const blobUrl = URL.createObjectURL(blob); const downloadLink = document.createElement('a'); downloadLink.href = blobUrl; downloadLink.download = fileName; document.body.appendChild(downloadLink); downloadLink.click(); downloadLink.remove(); URL.revokeObjectURL(blobUrl); button.textContent = 'HERUNTERLADEN'; } catch (error) { button.textContent = 'Download fehlgeschlagen'; } });