Some popular websites – including Mashable, The Huffington Post and TechCrunch – include too many internal links in their stories (hyperlinks pointing back to their own website) and it often becomes difficult to determine the links that are pointing to external websites.
You have to hover your mouse over a link and look at the status bar of your browser to know where that link is pointing to. That’s lot of work.
HIGHLIGHT EXTERNAL LINKS USING FAVICON IMAGES
Before: This is the original page on TechCrunch
After: The same page but the external hyperlinks are now highlighted
If you wish to quickly highlight all the external hyperlinks on a page, just drag the following bookmarklet link to your browser’s bookmarks toolbar.
Now when you are on a web page that looks cluttered with links, just click this bookmarklet button and it will add favicons next to all external hyperlinks on that page while the styling of internal links is left untouched.
The bookmarklet will also add underlines to external links making it easier for you to distinguish between external and internal links. And in case you wish to revert to the original style of hyerlinks, just hit the refresh button (Ctrl + R) in your browser.
her's the bookmarklet source code (de-obfuscated) in case you wish to modify the link styling. The favicons for corresponding websites are automatically generated using this simple Google hack.
// Highlight External Links by Way2Trick // Published on 06/17/2017 // Find the domain name of the current page var host = window.location.host; // Use Google's Favicon Generator var goog = "http://www.google.com/s2/favicons?domain="; // Find all hyperlinks on a web page var links = document.getElementsByTagName("a"); for (i=0; i<links.length; i++) { var link = links[i]; // Skip all internal links where the href is the same as the domain host // Also skip non HTTP links like FTP, MAILTO, etc. if(link.href.match("^https?://") && !link.href.match(host)) { var domain = link.href.split("/"); // Apply some CSS styles to the external hyperlinks link.style.background = "url(" + goog + domain[2] + ") center left no-repeat"; link.style.fontWeight = "bold"; link.style.fontSize = "105%"; link.style.padding="5px 5px 5px 20px"; link.style.textDecoration="underline"; } }
0 comments:
Post a Comment