Sam
Sam

Reputation: 165

Redirect to new page on PDF download

We have a thank-you page which features a link to download a PDF.

I'd like to redirect to another page when the link to download the PDF is clicked (and naturally trigger the .PDF download at the same time).

I've got a solution for Chrome & Opera but since it uses the HTML5 tag 'download' its' not supported by IE & Firefox.

<h2 style="text-align: center;"><a href="http://cdn2.hubspot.net/hub/155045/file-847580737-pdf/Stepping_into_a_new_age_of_marketing_with_CRM_FINAL_APPROVED.pdf" id="pdflink" download=""><strong>Click here to download your eBook</strong></a></h2>
<script type="text/javascript">// <![CDATA[
document.getElementById("pdflink").onclick = function () {
        location.href = "https://www.workbooks.com/case-studies";
    };
// ]]></script>

You can see the page at: http://content.workbooks.com/thank-you-new-age-of-marketing-crm

Please note I can't use internal and external CSS as the code is held on a Hubspot landing page so only inline CSS is open to me.

Upvotes: 1

Views: 1722

Answers (1)

McDit
McDit

Reputation: 96

Add a target="_blank" to the <a>

Edit: Just tested this. This opens the pdf in another window but sadly won't download it.

Upvotes: 1

Related Questions