Return 文件内容 Content-type 来自 Javascript
Return file contents with Content-type from Javascript
我正在尝试在 Weebly 网站中包含 vCard,但我需要 return Content-type header,因此简单的附件不起作用。我在 PHP 中找到了以下代码来执行此操作,但我不能在 Weebly 上包含 PHP 代码,只能包含 Javascript:
<?php
header("Content-type: text/x-vcard");
header("Content-Disposition: attachment; filename=\"contact.vcf\";");
echo file_get_contents("contact.vcf");
?>
有没有办法在 Javascript 中包含一个 return 这个按钮?
您应该可以将它添加到一个简单的锚标记中,浏览器会处理它。
<a href="contact.vcf">My Contact</a>
我正在尝试在 Weebly 网站中包含 vCard,但我需要 return Content-type header,因此简单的附件不起作用。我在 PHP 中找到了以下代码来执行此操作,但我不能在 Weebly 上包含 PHP 代码,只能包含 Javascript:
<?php
header("Content-type: text/x-vcard");
header("Content-Disposition: attachment; filename=\"contact.vcf\";");
echo file_get_contents("contact.vcf");
?>
有没有办法在 Javascript 中包含一个 return 这个按钮?
您应该可以将它添加到一个简单的锚标记中,浏览器会处理它。
<a href="contact.vcf">My Contact</a>