Last active
October 18, 2023 05:45
-
-
Save technicaldogsbody/f95d6c43f506161a0d497eb323ef8ab4 to your computer and use it in GitHub Desktop.
Download PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Download PDF JQuery</title> | |
</head> | |
<body> | |
<a target="_blank" href="sample.pdf">Donec non enim</a><br /> | |
<a download href="sample.pdf">Donec non enim</a><br /> | |
<a download="download.pdf" href="sample.pdf">Donec non enim</a><br /> | |
<a target="download" href="sample.pdf">Donec non enim</a><br /> | |
<a href="sample.pdf">Donec non enim</a><br /> | |
</body> | |
<script src="https://code.jquery.com/jquery-2.2.4.js"></script> | |
<script src="script.js"></script> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("a[target='download']").each(function () { | |
$(this).removeAttr("target"); | |
$(this).attr("download", ""); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Giving me the following : VM982:1 Uncaught SyntaxError: Unexpected token '?'
While downloading https://drive.google.com/file/d/1KOBInuZNTzjuFdP_pd2XFcTpu4KD5Ngz/view?pli=1