I have a website that generates dynamic calendar (icalendar). Lets assume that this calendar is accessible over HTTP at a URL like this
http://www.example.com/cal?q=<user query>
Everything works fine so far.
Now I want to let the users subscribe to this calendar with their favourite calendar client.
For ios I can achieve this if I publish the calendar URL with the webcal:// URL scheme.
Thank you
If you specifically want to support importing to Google Calendar, you can construct a link to the google calendar website with the webcal url as a uri encoded query param. Here's what constructing that link looks like in JS:
"https://calendar.google.com/calendar/r?cid=" + encodeURIComponent("webcal://www.example.com/cal/whatever-the-link-is")
The downside to this is that there's (as of this writing) no mobile friendly version of the Google Calendar website that supports this feature, so the user will get this very non mobile friendly looking page:

And of course, this will method will not work for users who don't use Google Calendar. For them, it might be best to just provide them with a webcal link for them to import manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With