Skip to content

Commit 4624432

Browse files
committed
Docs: Fix external links.
1 parent 71349ad commit 4624432

File tree

1 file changed

+17
-0
lines changed
  • utils/docs/template/static/scripts

1 file changed

+17
-0
lines changed

utils/docs/template/static/scripts/page.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ if ( typeof hljs !== 'undefined' ) {
2020

2121
} )();
2222

23+
// Open external URLs in new tabs
24+
( function () {
25+
26+
const links = document.querySelectorAll( 'a' );
27+
28+
for ( const link of links ) {
29+
30+
if ( link.href.match( /^https?:\/\//i ) ) {
31+
32+
link.setAttribute( 'target', '_blank' );
33+
34+
}
35+
36+
}
37+
38+
} )();
39+
2340
// Update URL hash when clicking on method/property links
2441
( function () {
2542

0 commit comments

Comments
 (0)