Code is as following:
<p class="downloadBoks" onclick="location.href='Prosjektplan.pdf'">Prosjektbeskrivelse</p>
Works fine like this, but it opens the file in the same window. I want to apply the target="_blank". But after some googleing I still can't figure it out.
Instead use window.open()
:
The syntax is:
window.open(strUrl, strWindowName[, strWindowFeatures]);
Your code should have:
window.open('Prosjektplan.pdf');
Your code should be:
<p class="downloadBoks"
onclick="window.open('Prosjektplan.pdf')">Prosjektbeskrivelse</p>