{"by":"momciloo","descendants":129,"id":38413660,"kids":[38417315,38416214,38419165,38420221,38419895,38417243,38417443,38415286,38417486,38416695,38418685,38420374,38416287,38431386,38416156,38429114,38417839,38415396,38419810,38416176,38420176,38423263,38419377,38415719,38415450,38419708,38424490,38415279,38415783,38415837,38420874,38418897,38416386,38417806,38417341,38416587,38415840,38415809,38415530,38416954,38415856,38415408],"score":403,"text":"Two browser windows (acting as socket clients) communicate their:<p>- Screen dimensions - (screen.width, screen.height)<p>- Window dimensions - (window.innerWidth, window.innerHeight)<p>- Window X&#x2F;Y position - (window.screenX, window.screenY)<p>...or whichever calculation works best for you.<p>The original work by Bjorn Staal <a href=\"https:&#x2F;&#x2F;twitter.com&#x2F;_nonfigurativ_&#x2F;status&#x2F;172732259457002734\" rel=\"nofollow noreferrer\">https:&#x2F;&#x2F;twitter.com&#x2F;_nonfigurativ_&#x2F;status&#x2F;172732259457002734</a> used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.<p>Here&#x27;s a demo of how it works and the codebase: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;Momciloo&#x2F;fun-with-sockets&#x2F;\">https:&#x2F;&#x2F;github.com&#x2F;Momciloo&#x2F;fun-with-sockets&#x2F;</a>","time":1700921809,"title":"Show HN: I saw this mind-blowing experiment, so I made a simple version of it","type":"story","url":"https://github.com/Momciloo/fun-with-sockets"}