From 64906a529cc48869791e663ba6d203baed236f6f Mon Sep 17 00:00:00 2001 From: morning-star Date: Wed, 14 Jun 2023 18:57:43 +0800 Subject: [PATCH] fix: prevent opening new tab for a tags with javascript href (#94) --- src/output/srcdoc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/srcdoc.html b/src/output/srcdoc.html index c2b939d6..3261a45c 100644 --- a/src/output/srcdoc.html +++ b/src/output/srcdoc.html @@ -80,7 +80,7 @@ while (el && el.nodeName !== 'A') el = el.parentNode; if (!el || el.nodeName !== 'A') return; - if (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target) return; + if (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target || el.href.startsWith('javascript:')) return; event.preventDefault();