Search code examples
htmlhyperlinkcalendaricalendar

I want HTML link to .ics file to open in calendar app when clicked, currently opens file as plain text. Suggestions?


I am linking to an .ics file exported from Apple iCal in an HTML web page.

<a href="calendar.ics">

This link will open the calendar.ics file as plain text in my browser (Chrome). I want automatic opening in Outlook or iCal or other calendar apps. What can I add to the link tag in order to produce the desired behavior? What about modifying the HTTP headers on .ics files?

Any suggestions are appreciated!


Solution

  • If your site is built on Linux like mine you can simply add a line to your htaccess file to make it open as a download instead of a text page.

    add this to your htaccess file:

    AddType text/calendar .ics