Open popup at center

HTML

<a id="openPopup" href="http://mywebsite.com" target="popup">
    Open Link in Popup
</a>

JavaScript

document.querySelector("#openPopup").onclick = function() {
  let Y = window.outerHeight / 2 - 300;  /* 0.5 * windowHeight - 0.5 * popupHeight */
  let X = window.outerWidth / 2 - 300;   /* 0.5 * windowWidth - 0.5 * popupWidth */
  window.open("http://mywebsite.com", 'popup', `width=600,height=600,top=${Y},left=${X}`);
  return false;
}