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
HatchedLake721#
Oh wow, from December 2008.

Here's to no one trying to patent it now!

whenlambo2 replies#
What API allowed that back then?
placebo#
It was an API I developed using ActiveX on Microsoft's Internet explorer and NPAPI on other browsers
worldsayshi#
I don't see what is technically new about this? What API has been missing to do this?

Tcp and window.screenTop and screenLeft should get you there right? Hmm, yeah, 2008 is a long time ago though..

adroitboss#
Thanks! I am adding this one to my list!
amelius#
The mind-blowing part is not that this works, but that it is secure.
bdcravens#
Love how simple the code is, with almost no external dependencies

Load more comments