-
Within a HTML block I use the following code:
<div style=”text-align: center; font-size: 13px; margin-top: 10px;”>
{
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: ‘https://myurl.de/nn’, title: ‘Popup’, w: 350, h: 750 });”>
NN
<br />
Ort (Nord)</div>The ending quote of JS is not recognized. Where is the error? JS code checker don’t find an error. This is independant of the browser.
The purpose of the code is to output a new window in the mid of the screen.
You find the code on the marked place.
-
Alvind
Hi there,
The HTML block is a core WordPress block, so we don’t have full insight into how it may interfere with JavaScript parsing, unfortunately.
- You must be logged in to reply to this topic.