From d5b30f9f5238a0a57ac1885a6c0d12fa49947711 Mon Sep 17 00:00:00 2001 From: Adrian Vollmer Date: Wed, 12 Oct 2022 12:54:03 +0200 Subject: [PATCH] Open external links in new tab --- zundler/assets/inject.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zundler/assets/inject.js b/zundler/assets/inject.js index 39ae6a3..d203d41 100644 --- a/zundler/assets/inject.js +++ b/zundler/assets/inject.js @@ -91,6 +91,10 @@ var fix_link = function(a) { a.addEventListener('click', virtual_click); } else if (a.getAttribute('href').startsWith('#')) { a.setAttribute('href', "about:srcdoc" + a.getAttribute('href')) + } else { + // External links should open in a new tab. Browsers block links to + // sites of different origin within an iframe for security reasons. + a.setAttribute('target', "_blank"); } };