'Mobile browsers are adding .html to filename on download
For some reason, with this code:
header("Content-Type: text/x-vcard;charset=utf-8;");
header("Content-Disposition: attachment; filename=card.vcf");
header("Pragma: no-cache");
header("Expires: 0");
echo $vcard_serialized;
on chrome from Pc, it downloads card.vcf
, but from mobile it downloads card.vcf.html
... why?
Solution 1:[1]
I have the same issue, but now I already fixed it using the codes below:
header('Content-Description: Download vCard');
header('Content-Type: text/vcard');
header('Content-Disposition: attachment; filename='.$your_filename_here);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
ob_clean();
flush();
echo $vcard_serialized; //echo the content
exit;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | not_null |