简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM