Skip to content

Commit

Permalink
Test external links.
Browse files Browse the repository at this point in the history
  • Loading branch information
g-pacheco committed Apr 12, 2024
1 parent 83e32e9 commit ba4b854
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions _scripts/ext-links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
make all external links open in a new tab
*/

{
const onLoad = () => {
// for each link
const links = document.querySelectorAll("a");
for (const link of links)
try {
// if link absolute and different domain
if (new URL(link.src).hostname !== new URL(window.location).hostname)
// make link open in new tab
link.setAttribute("target", "_blank");
} catch (error) {}
};

// after page loads
window.addEventListener("load", onLoad);
}
Binary file added images/Bissoli_Photo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Bissoli_Photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/GralhaAzul_Photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ba4b854

Please sign in to comment.