Skip to content

Commit 8b8c543

Browse files
committed
Open external site links in a new window
1 parent 7b3fa19 commit 8b8c543

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/reference/themes/mongodb/static/js/scripts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ jQuery(document).ready(function(){
1717
jQuery('[data-toggle="tooltip"]').tooltip();
1818
jQuery("body").addClass("hljsCode");
1919
hljs.initHighlightingOnLoad();
20+
var linkRegex = new RegExp('/' + window.location.host + '/');
21+
jQuery('a').not('[href*="mailto:"]').each(function () {
22+
if ( ! linkRegex.test(this.href) ) {
23+
$(this).attr('target', '_blank');
24+
}
25+
});
2026
});

0 commit comments

Comments
 (0)