Lurker News
Two browser windows (acting as socket clients) communicate their:

- Screen dimensions - (screen.width, screen.height)
- Window dimensions - (window.innerWidth, window.innerHeight)
- Window X/Y position - (window.screenX, window.screenY)
...or whichever calculation works best for you.
The original work by Bjorn Staal https://twitter.com/_nonfigurativ_/status/172732259457002734 used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.
Here's a demo of how it works and the codebase: https://github.com/Momciloo/fun-with-sockets/

Comments (129) 42 threads

Show all comments

Showing thread 37 of 42

no_time3 replies#
W-why is window LOCATION exposed to websites? Apparently even in FF private browsing...

At first I thought this is an electron only thing. I get it that we gave up on fingerprinting resistance but this is like pissing on it's grave.
EDIT: privacy.resistFingerprinting set to true fixes the coords to 0

a_wild_dandan#
I thought you meant literal `window.location` and was confused, but yeah `window.screenX/Y` is a pretty suspect feature, now that you mention it.
crazygringo#
I'm as surprised as well.

I'm trying to guess why, and can only imagine that at some point the idea was to support multi-window webapps, like maybe you'd have separate windows for documents and different tool palettes, and they'd want to know each other's locations to try to prevent overlaps? I mean, back in the day, framesets were another idea that experienced some popularity before being totally eclipsed by -- all of this back in the era when everything was based on the multiple-windows paradigm rather than the multiple-tabs paradigm. Window.screenLeft apparently originated in IE [1].
Just a guess though. Very curious if there's any legitimate reason for it to continue to exist, or whether W3 ought to deprecate it.
[1] https://developer.mozilla.org/en-US/docs/Web/API/Window/scre...

thayne#
On Wayland, a native window can't even get that information. At least not in a way that works across composiotors.