Use to a tab in the background (not switch focus)

I’m using the following code to open a new tab on click of a PDF download.

The problem is the new tab becomes the main tab often before the PDF loads.

How can I make the view stay on the current window (PDF) and open the new tab but not switch to it?

Note: In Chrome and Opera they understand the HTML5 download tag so the PDF simply downloads and the current window redirects – All good! So this is only a problem on IE & Firefox.

<h2 style="text-align: center;"><a href="" onclick="casestudiesopen()" download><strong>Click here to download your eBook</strong></a></h2>

function casestudiesopen() {"");

Source: html5

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.