JSFiddle - React, Tailwind, and code Playground

by Alex Alex

HTML

Opened by javascript<br>
<a href="https://www.google.com">Close by javascript</a><br>
<small>(open google.com when fails)</small>

JavaScript

if (window.opener && window.opener !== window) {
    document.querySelector('a').addEventListener('click', function (e) {
        e.preventDefault();
        window.close();
    }, false);
}