Skip to content

Instantly share code, notes, and snippets.

@technicaldogsbody
Last active October 18, 2023 05:45
Show Gist options
  • Save technicaldogsbody/f95d6c43f506161a0d497eb323ef8ab4 to your computer and use it in GitHub Desktop.
Save technicaldogsbody/f95d6c43f506161a0d497eb323ef8ab4 to your computer and use it in GitHub Desktop.
Download PDF
<!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>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$(function() {
$("a[target='download']").each(function () {
$(this).removeAttr("target");
$(this).attr("download", "");
});
});
@adickdid69
Copy link

Giving me the following : VM982:1 Uncaught SyntaxError: Unexpected token '?'
While downloading https://drive.google.com/file/d/1KOBInuZNTzjuFdP_pd2XFcTpu4KD5Ngz/view?pli=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment