JSFiddle - React, Tailwind, and code Playground

HTML

Links:

<ul>
    <li><a href="http://google.com">Google</a></li>
    <li><a href="http://superuser.com">Super User</a></li>
</ul>

Test:

<ol>
    <li>Observe that the above links are purple, since their URLs are in your browser's history.</li>
    <li>Hover over the links and observe the clean URLs in the status bar.</li>
    <li>Right-click the first link and close the context menu.</li>
    <li>Observe that the link's color has changed to blue and that the status bar now shows the redirection URL.</li>
    <li>Middle-click the second link to open its target in a new tab.</li>
    <li>Observe that the link's color status purple, since opening the redirection URL is a new tab placed it in your browser's history.</li>
</ol>

JavaScript

// define a function `f' that changes a link's clean URL to a redirection URL
var f = function () {
    // prepend `http://www.google.com/url?rct=j&url=' to the link's target
    this.href = 'http://www.google.com/url?rct=j&url=' + escape(this.href);
    // don't invoke this function anymore when clicking the link
    this.removeEventListener('click', f);
    // don't invoke this function anymore when right-clicking the link
    this.removeEventListener('contextmenu', f);
}

// save all <a> tags in an array `a'
var a = document.getElementsByTagName('a');

// for each <a> tag in the array `a'
for (var i = 0; i < a.length; i++) {
    // execute function `f' when clicking the link
    a[i].addEventListener('click', f);
    // execute function `f' when right-clicking the link
    a[i].addEventListener('contextmenu', f);
}