External links in new tabs #3141
Answered
by
squidfunk
alandefreitas
asked this question in
Q&A
-
Is there an easy way to open all external links in a new tab and internal links in the same tab? |
Beta Was this translation helpful? Give feedback.
Answered by
squidfunk
Oct 18, 2022
Replies: 2 comments
-
You could use some additional JavaScript: document.addEventListener("DOMContentLoaded", () => {
for (const link of Array.from(document.querySelectorAll(".md-typeset a[href^=http]")))
link.target = "_blank"
}) |
Beta Was this translation helpful? Give feedback.
0 replies
-
The built-in privacy plugin now allows to automatically add |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
squidfunk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The built-in privacy plugin now allows to automatically add
target=_blank
to all external links, so they open in new tabs.