mar*_*cin 1 html javascript php html5 onclick
我想制作一个DIV onclick,它将打开一个对话框来保存pdf文件.
像这样的东西(html5 a href):
<a href="path" download>download</a>
Run Code Online (Sandbox Code Playgroud)
但在DIV上使用onclick事件.
我试过但它不起作用:
<div onClick="window.location='path' download">something</div>
Run Code Online (Sandbox Code Playgroud)
小智 8
<div onClick="window.location=location/to/file/pdf.php">something</div>
Run Code Online (Sandbox Code Playgroud)
pdf.php:
<?php
header('Content-disposition: attachment; filename=your_file.pdf');
header('Content-type: application/pdf');
readfile('path/to/your_file.pdf');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17867 次 |
| 最近记录: |