Skip to content

Commit 64906a5

Browse files
authored
fix: prevent opening new tab for a tags with javascript href (#94)
1 parent 01ad733 commit 64906a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/output/srcdoc.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
while (el && el.nodeName !== 'A') el = el.parentNode;
8181
if (!el || el.nodeName !== 'A') return;
8282

83-
if (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target) return;
83+
if (el.hasAttribute('download') || el.getAttribute('rel') === 'external' || el.target || el.href.startsWith('javascript:')) return;
8484

8585
event.preventDefault();
8686

0 commit comments

Comments
 (0)