Estoy tratando de generar un archivo ics y permitir que el usuario lo descargue. Funciona en todos los navegadores excepto iOS Chrome y Firefox. iOS Chrome descargará el archivo, pero cambiará el nombre a documento y extensión de datos. ¡Alguien sabe cuál es el motivo y me ayuda, por favor!
const iOS = (/iPad|iPhone|iPod/.test(userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 0)) && !window.MSStream; var icsMSG = 'BEGIN:VCALENDAR\n' + 'VERSION:2.0\n' + 'PRODID:-//...//NONSGML ...//EN\n' + 'METHOD:PUBLISH\n' + 'BEGIN:VEVENT\n' + `SUMMARY:${appointment?.location?.clinicName} Appointment for ${identity.firstName} ${identity.lastName}\n` + 'ORGANIZER;CN=abc\n' + `DTSTART:${startTime}\n` + `DTSTAMP:${startTime}\n` + `LOCATION:${location}\n` + 'BEGIN:VALARM\n' + 'TRIGGER:-PT30M\n' + 'REPEAT:1\n' + 'DURATION:PT15M\n' + 'ACTION:DISPLAY\n' + 'DESCRIPTION:Reminder\n' + 'END:VALARM\n' + `DESCRIPTION:${appointment?.care?.caretype}; Estimated length: ${ appointment?.care?.estTime } minutes; Provider: ${appointment.provider.name}, ${ appointment.provider.type }; Estimated cost: ${!hasInsurance ? 'without insurance' : ''} ${ appointment?.care?.estCost }\n` + 'END:VEVENT\n' + 'END:VCALENDAR'; var blob = new Blob([icsMSG], { type: 'text/calendar;charset=utf-8' }); if (iOS) { var reader = new FileReader(); reader.onload = function (e) { window.location.href = reader.result; }; reader.readAsDataURL(blob); } else { const url = window.URL.createObjectURL(blob); const link = document.createElement('a'); link.href = url; link.download = 'calendar.ics'; // TODO: Try to not use blob but replace https with webcal so calendar can open automatically document.body.appendChild(link); link.click(); document.body.removeChild(link); }```