Skip to content

Commit

Permalink
fix: prevent opening new tab for a tags with javascript href (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sight-wcg committed Jun 14, 2023
1 parent 01ad733 commit 64906a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/output/srcdoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 64906a5

Please sign in to comment.