How to download pdf via js click (no page skipping, no refresh)

var $eleForm = $("<form method="get"></form>")
$eleForm.attr("action", "xxxxxxx")
$(document.body).append($eleForm)
pdf  a  
<a href="xxxx" download></a>
Apr.10,2022

turn off the default opening function of the browser


not all browsers can open files. You can download it directly by changing it to Sogou browser or 360browser . I think you should be using Chrome browser now, so you will open PDF files. This function can be turned off in the settings. Chrome browser can open pictures and PDF files by default, and other files can be downloaded using the above method.


download this is a new attribute, which is not supported by some browsers. To download or open it directly, it is set by the backend interface content-Type


to fully support downloading, you need to rely on the backend

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e44846-44abd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e44846-44abd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?