I try to force the download of a (generated) vcf file (vcard) via template, which worked without problems in Kirby 2, on an updated site with Kirby 3.
templates/contact.php
(reduced and static to test):
<?php
header('Content-Type: text/x-vcard');
header('Content-Disposition: attachment; filename="test.vcf"');
?>
BEGIN:VCARD
VERSION:2.1
N:Gump;Forrest;;Mr.
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
ADR;WORK;PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;WORK;PREF;ENCODING#QUOTED-PRINTABLE;CHARSET#UTF-8:100 Waters Edge#0D#
#0ABaytown\, LA 30314#0D#0AUnited States of America
ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;HOME;ENCODING#QUOTED-PRINTABLE;CHARSET#UTF-8:42 Plantation St.#0D#0A#
Baytown, LA 30314#0D#0AUnited States of America
EMAIL:forrestgump@example.com
REV:20080424T195243Z
END:VCARD
When I open localhost/contacts/contact
on my desktop browser it asks to download test.vcf. It basically works. But when I try to open it from my mobile (iPhone in this case) it only offers to download “test.vcf.htm”, which can be downloaded and opened with the correct content, but is treated as a text/htm file… which is a pain on a mobile device. It should straight up open a contact sheet, as it did with Kirby 2.
When I test it with a plain .php file on the server and call that… it works on the iPhone. Kirby 3 gets in the way somewhere… and I don’t know where
Any ideas? Thanks!
(Kirby 3.6.2)