diff options
| author | William Hergès <william@herges.fr> | 2025-10-05 15:16:20 +0200 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-10-05 15:16:20 +0200 |
| commit | fa5ac4040e8e2fc57bef5c598e1ceda4c2fc0a73 (patch) | |
| tree | 5dbbba0ec6101fb666ee88a977a21ef95d55a2e9 /frontend | |
| parent | 5d6198f168dd1a8598048718d149d1171df09c1a (diff) | |
feat(backend): add noreferer on external link and move target blank
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/index.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/frontend/index.ts b/frontend/index.ts index 9babe4a..d4fbe2a 100644 --- a/frontend/index.ts +++ b/frontend/index.ts @@ -4,10 +4,8 @@ htmx.config.historyRestoreAsHxRequest = false; function setupAnchors() { document.querySelectorAll("a").forEach(e => { - if (!e.href.startsWith(window.location.origin) && /https?:\/\//.test(e.href)) { - e.target = "_blank"; - return - } + // stuff related to external links are already handled in the backend + if (!e.href.startsWith(window.location.origin) && /https?:\/\//.test(e.href)) return if (e.hasAttribute("hx-trigger")) return; e.setAttribute("hx-get", e.href) e.setAttribute("hx-trigger", "click") |
