JSFiddle - React, Tailwind, and code Playground
by Ronny
HTML
<a href="http://www.google.com" target="_blank" onclick="openPopup('http://www.google.com'); return false;">Google</a>
<br>
<a href="http://www.google.com" target="_blank" onclick="openPopup('http://www.google.com', 850, 130); return false;">Google (smaller)</a>
JavaScript
function getWidth(){
var width = window.innerWidth || document.documentElement.clientWidth;
return width;
}
function getHeight(){
var height = window.innerHeight || document.documentElement.clientHeight;
return height;
}
function openPopup(url, width, height) {
var width = width || 400;
var height = height || 250;
var centerWidth = getWidth() / 2 - width / 2;
var centerHeight = getHeight() / 2- height / 2;
window.open(url, '_blank', 'toolbar=0,scrollbars=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + height + ',top=' + centerHeight + ', left = ' + centerWidth);
}