Mit dem folgenden Code möchte ich Fenster fester Größe zentrieren.
<div style="text-align: center; font-size: 13px; margin-top: 10px;">
<a onclick="
const popupCenter = ({ url, title, w, h }) => {
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
const width = window.innerWidth document.documentElement.clientWidth
screen.width;
const height = window.innerHeight document.documentElement.clientHeight
screen.height;
const systemZoom = width / window.screen.availWidth;
const left = (width - w) / 2 / systemZoom + dualScreenLeft;
const top = (height - h) / 2 / systemZoom + dualScreenTop;
const newWindow = window.open(url, title, `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
if (window.focus) {
newWindow.focus();
}
};
popupCenter({ url: '/nn', title: 'Popup', w: 350, h: 750 });">
<strong>NN</strong></a>
<br />
<a href="#ort">Ort</a> (Südost)</div>
Leider versteckt sich irgendwo ein Fehler, den ich nicht finde. Der Parser erkennt das Ende der <a Anweisung nicht. Die Smileys sind zwei senkrechte Striche!