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

Earlier comments
hot_gril#
This reminds me of a project I did in school, a multi-user web browser. You could both control the same window's size, scroll position, and other state on each other's screens. The intended usage was having 2+ windows side by side.
account421 reply#
None of these screen properties should be available to websites.
nomel1 reply#
Width and height definitely need to be. I can't imagine why absolute position were ever needed.
account42#
Viewport width/height: yes since thats unavoidable, window width/height: no, screen width/height: hell no.
jocaal4 replies#
The available API's on the web are very questionable. Feross has a web security lecture series on youtube where he showed off the following abomination. Enter at own risk.

https://theannoyingsite.com/

lgats2 replies#
warning, this is really annoying. imagine you're infected with a ton of adware in the early 2000s you will be logged out of many accounts

here's someone testing it out on Windows a few years ago, but I assure you even in the latest chrome on mac, it's at least as bad https://youtu.be/estvbRSj4LU?si=gq6-l4pWLC9yXqap&t=109

dylan6041 reply#
Why would you keep minimizing things instead of closing them? The video just looks like one of those meant to frustrate the viewer into wanting to do it themselves. I blame the creator of that video as much as the site itself. The site itself served a purpose. The person running that video has a much less clear motive
b1121 reply#
I think if you close a window, another pops up. Or two.

You should go to this site and test this.

Continue this thread — 1 reply

PakG1#
I tried it on Safari private window. It was absolutely horrible. I hesitate to guess what would have happened if I didn't keep clicking cancel whenever it asked if I wanted to allow downloads, etc.
381 reply#
uBlock Origin has prevented the following page from loading:

    https://theannoyingsite.com/
Because of the following filter:

    ||theannoyingsite.com^$document
Found in:

    uBlock filters – Badware risks
derangedHorse#
holy shit, I was not expecting that LOL
CrimsonRain#
It lived up to its name for sure!!
orobinson#
This is cool. It reminds me of a research team I worked in a few years back that had built something like this for mobile devices. It used a camera overhead to provide info about device positions, allowing all the devices to act as a single screen on a surface [0].

[0] http://www.huddlelamp.org/#tech-video

Load more comments