You can just use document.body.
I also suggest to use a data URL instead. E.g. "data:," is an empty plain text file, which, as you can imagine, won't be interpreted as a valid image.
let image = new Image(); image.onerror = () => { console.log(image.width); // 0 -> headless }; document.body.appendChild(image); image.src = 'data:,';
The zoom doesn't affect this. It's always in CSS "pixels".
You can just use document.body.
I also suggest to use a data URL instead. E.g. "data:," is an empty plain text file, which, as you can imagine, won't be interpreted as a valid image.
> In case of a vanilla Chrome, the image has a width and height that depends on the zoom of the browserThe zoom doesn't affect this. It's always in CSS "pixels".