carlsednaoui / add-to-calendar-buttons

Easily add a "add to calendar" button to your websites. This JavaScript library supports Google Calendar, iCal, Outlook and Yahoo Calendar.
476 stars 171 forks source link

.ics file fails to download for iCal and Outlook links #22

Open tommarshall opened 7 years ago

tommarshall commented 7 years ago

Clicking the 'iCal Calendar' or 'Outlook Calendar' links does not download the .ics file. The browser flashes, but no file is downloaded, and no new tab is opened.

Browser: Chrome 60.0.3112.90 (Official Build) (64-bit) OS X

tommarshall commented 7 years ago

'Copy link address' and pasting that into a fresh tab, does work however.

Removing the target="_blank" attribute from the <a> tag appears to resolve the issue, though I don't know if that breaks the links in other browsers.

julienV commented 6 years ago

added a PR with the fix https://github.com/carlsednaoui/add-to-calendar-buttons/pull/28/files#diff-05d0073950a034e1c5a54e507a4d3e54L62

damianvila commented 6 years ago

Better to replace the target="_blank" with a "download" parameter.

julienV commented 6 years ago

looks like it's not supported on safari, and only recently on other browsers. I could put it in addition of the target attribute though

damianvila commented 6 years ago

Afaik, it's supported as of Safari 10.3 on iOS and Safari 10.1 on MacOS: https://webkit.org/blog/7477/new-web-features-in-safari-10-1/ The "Can I use" site is a bit outdated on that feature.

LittleDogFido commented 5 years ago

Perhaps I'm doing something wrong(I am relatively new to all of this) but I notice no changes after adding the gulpfile.js and ouimincal.js. The download attribute seems to be enough to get around this on Chrome, but not IE. When I add both the gulpfile.js/outmincal.js after changing target_blank to download, it ceases to work again.

julienV commented 5 years ago

don't include the gulpfile.js in your html code, it's just there for development to generate the ouical.min.js from the ouical.js file... just include either ouical.js, or the minified version

julienV commented 5 years ago

@LittleDogFido i updated my PR, the direct ouical file link is here: https://raw.githubusercontent.com/carlsednaoui/add-to-calendar-buttons/683bdf8e1a51ce5f5b84f1c1096a245bf22fc219/ouical.js

LittleDogFido commented 5 years ago

Thanks so much for your reply and the updated file. Even while I was doing it it was unclear to me why they would all be necessary. I still can't seem to get Outlook to work on Internet Explorer however, which is what I thought this would solve based on your comment in that issue thread. Perhaps there is another unrelated issue on my end preventing the fix from working.

julienV commented 5 years ago

not sure, my goal was just to fix the iCal download issue, but i can't help with IE as i am on linux.