vCard .vcf file download browser support - godaddy [closed]

本秂侑毒 提交于 2019-11-30 10:48:08

As a first step, ask Godaddy whether they support AddType directives and if yes, how. That solution would definitely be preferable.

Alternatively, you may be able to work around it using a primitive PHP script that sends the correct headers.

contact.php (untested):

<?php
  # Send correct headers      
  header("Content-type: text/x-vcard"); 
                    // Alternatively: application/octet-stream
                    // Depending on the desired browser behaviour
                    // Be sure to test thoroughly cross-browser

  header("Content-Disposition: attachment; filename=\"contact.vcf\";");
  # Output file contents 
  echo file_get_contents("contact.vcf");
 ?>

this would serve the VCF file with the correct header.

Turns out what i was doing was correct just took a while for it to start working. Then when it still did not work in Firefox had to clear offline memory and started working too.

Based on the MIME-Type (in your post text/x-vcard) the browser decides weather to open the file inside the browser or to start a download.

One easy way is to tell the server to offer files ending with .vcf with a ohter MIME-type. Here you should select a type where you can be sure that the browser will always download it:

Try: AddType application/octet-stream vcf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!