I need a PDF to download automatically once a page loads. I didn't think this would be that complicated. I am not a developer. I just work in marketing. So this might be super obvious.
I found some javascript code on this thread and I gave it a try but it redirects the page you're on to the PDF - instead of leaving the user on their current page and just downloading the PDF.
JAVASCRIPT:
$(function() {
$('a[data-auto-download]').each(function(){
var $this = $(this);
setTimeout(function() {
window.location = $this.attr('href');
}, 2000);
});
});
HTML
<p>The download should start shortly. If it doesn't, click
<a data-auto-download href="/your/file/url">here</a>.</p>
I also tried the iframe method, with the iframe set to display:none but that didn't work. I didn't think it would though because wouldn't a PDF just display in the iframe, since that's what it does in a browser?
Another idea is would the above code work if I created a PHP file like they talk about in this thread?