Links to documents – Where they open to | Promotion Forum

If your BBCode editor supports HTML attributes, just add the `target =" _ blank "` attribute to your .pdf link. So:

Code:

[a href="#" target="_blank"]Text link[/a]

Alternatively, you can write a script that adds this attribute to all links that end with .pdf:

jQuery:

Code:

$ (& # 39; a[href$=".pdf"]& # 39;) .attr (& # 39; target & # 39;; & # 39; _blank & # 39;);

Vanilla:

Code:

let link = document.querySelector (& # 39; a[href$=".pdf"]& # 39;);
link.setAttribute (& # 39; target & # 39; _blank & # 39;);

However, you can consider the remarks made on opening links in a new tab of this article on CSS tips:

When to use target=”_blank”