MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Created page with "→Any JavaScript here will be loaded for all users on every page load.: document.addEventListener("DOMContentLoaded", function () { const links = document.querySelectorAll("#bodyContent a.external"); for (const link of links) { link.setAttribute("target", "_blank"); link.setAttribute("rel", "noopener noreferrer"); } });" |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
document.addEventListener("DOMContentLoaded", function () { | document.addEventListener("DOMContentLoaded", function () { | ||
const links = document.querySelectorAll(" | const links = document.querySelectorAll("a.download-link"); | ||
for (const link of links) { | for (const link of links) { | ||
link.setAttribute("target", "_blank"); | link.setAttribute("target", "_blank"); | ||
link.setAttribute("rel", "noopener noreferrer"); | link.setAttribute("rel", "noopener noreferrer"); | ||
link.setAttribute("download", ""); | |||
} | } | ||
}); | }); |
Latest revision as of 20:07, 17 April 2025
document.addEventListener("DOMContentLoaded", function () { const links = document.querySelectorAll("a.download-link"); for (const link of links) { link.setAttribute("target", "_blank"); link.setAttribute("rel", "noopener noreferrer"); link.setAttribute("download", ""); } });