I'm trying to dynamically generate a vCal file using Javascript and everything is working fine until i try in IE8. In IE8 the browser tries to open the calendar file in the request bar instead of downloading. This is a sample of the code i use
var iCal =
"BEGIN:VCALENDAR\n" +
"PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN\n" +
"METHOD:PUBLISH\n" +
"BEGIN:VEVENT\n" +
"ATTENDEE;CN=\""+locationAlias+"\";CUTYPE=RESOURCE;ROLE=NON-PARTICIPANT;RSVP=TRUE:mailto:"+locationEmail+"\n" +
"DTEND;TZID=\"GMT Standard Time\":"+dend+"\n" +
"DTSTART;TZID=\"GMT Standard Time\":"+dstart+"\n" +
"LOCATION:"+locationName+"\n" +
"ORGANIZER;CN=\"<someuser>\":mailto:<somemailto>\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
return iCal;
I then try to open the calendar file using the following;
window.open( "data:text/calendar;charset=utf8," + escape( iCal) );
Any suggestions as to why IE8 cannot recognize the file?