Show HN: I saw this mind-blowing experiment, so I made a simple version of it (opens in a new tab)github.com
403 pointsTwo 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
Earlier commentsAt 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
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...
people forget lesson from recent past. i don't know when google strong armed w3c to include this back... but we had this since ie4 days and then disabled everywhere since it was abused left and right for click jacking attacks.
Continue this thread — 1 reply
[1] https://developer.mozilla.org/en-US/docs/Web/API/Battery_Sta...
I hadn't ever heard of this. Here is a statement from the Tor project for anyone else wondering what this is about:
> We automatically resize new browser windows to a 200x100 pixel multiple based on desktop resolution which is provided by a Firefox patch. To minimize the effect of the long tail of large monitor sizes, we also cap the window size at 1000 pixels in each direction. In addition to that we set privacy.resistFingerprinting to true to use the client content window size for window.screen, and to report a window.devicePixelRatio of 1.0. Similarly, we use that preference to return content window relative points for DOM events. We also force popups to open in new tabs to avoid full-screen popups inferring information about the browser resolution. In addition, we prevent auto-maximizing on browser start, and inform users that maximized windows are detrimental to privacy in this mode
Continue this thread — 1 reply
It would be another matter if this was a very useful feature, but I don't think that it is.
Here's one use for it: Ads could sense that they are off-screen and withhold content until the ad is moved back in view. I could easily see screenX/Y being used for that. I mean, I hope not, but how am I going to stop it?
click jacking is always fun.
https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_C...
Sounds like OP wanted to use sockets for fun though.
>The original work by Bjorn Staal used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.
Who among us hasn't overcomplicated things for fun? :)
Anyway nice repo, thanks for sharing!
All comments shown.
Couldn't load more comments. Check your connection and try again.