-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use javascript to open new tab for external links (#5159)
Signed-off-by: cosmicBboy <[email protected]>
- Loading branch information
1 parent
f5f8230
commit b1cab3a
Showing
5 changed files
with
10,968 additions
and
1,158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Add event listener for DOMContentLoaded event | ||
window.addEventListener("DOMContentLoaded", function() { | ||
// Select all <a> elements with class "external" | ||
var externalLinks = document.querySelectorAll("a.external"); | ||
|
||
// Loop through each <a> element with class "external" | ||
externalLinks.forEach(function(link) { | ||
// Set the target attribute to "_blank" | ||
link.setAttribute("target", "_blank"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.