8

I have an ICS file ('text/calendar' MIME type) stored on my server.

In JavaScript I call:

window.open("/path/to/file.ics");

It works on all browsers, even on Safari on my iPhone. But when I try on Chrome (the iPhone version) nothing happens. Nothing downloads. There are no errors on the screen―nothing.

Maybe someone has been there before and has some suggestions.

Thanks in advance!

Trevor Reid
  • 3,310
  • 4
  • 27
  • 46
Pablo
  • 9,424
  • 17
  • 55
  • 78
  • Same problem. Googling around finds a few (but not as many as expected) people with the same problem, but nothing that definitively confirms it won't work... – Adam Aug 22 '17 at 09:25
  • Possible duplicate of [ICS file Download fails on iPhone Chrome with "Unknown File Type"](https://stackoverflow.com/questions/15972628/ics-file-download-fails-on-iphone-chrome-with-unknown-file-type) – Adam Aug 22 '17 at 10:36
  • Use the webcal:// protocol for Chrome in iOS like addevent.com does – Vlax Jun 07 '19 at 10:41

1 Answers1

0

It should also be possible to use the good old create a download link, append it to the document, click it, and then remove it trick.

let icsLink = document.createElement("a");
icsLink.style.display = "none";
icsLink.href = "/path/to/file.ics";
icsLink.setAttribute("download","download");
document.body.appendChild(icsLink);
icsLink.click();
document.body.removeChild(icsLink);
Thor
  • 198
  • 1
  • 8