Créer un fichier .ics avec javascript ou jquery

Je suis en train de créer un .ics fichier lorsqu'un utilisateur clique sur un bouton.

Jusqu'à présent, le code que j'ai est

msgData1 = $('.start-time').text();
msgData2 = $('.end-time').text();
msgData3 = $('.Location').text();

var icsMSG = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Our Company//NONSGML v1.0//EN\nBEGIN:VEVENT\nUID:[email protected]\nDTSTAMP:20120315T170000Z\nATTENDEE;CN=My Self ;RSVP=TRUE:MAILTO:[email protected]\nORGANIZER;CN=Me:MAILTO::[email protected]\nDTSTART:" + msgData1 +"\nDTEND:" + msgData2 +"\nLOCATION:" + msgData3 + "\nSUMMARY:Our Meeting Office\nEND:VEVENT\nEND:VCALENDAR";

$('.button').click(function(){
    window.open( "data:text/calendar;charset=utf8," + escape(icsMSG));
});

Cela télécharge un .ics fichier mais lorsque je tente d'ouvrir ce dans iCal je me suis dit qu'il ne peut pas lire le fichier.

source d'informationauteur joshuahornby10