i will never forget that time when i discovered that if you have two bandcamp tabs, one of which is playing, and you start playing in the other, the first one will pause, and it was all being done with a very complicated message bus based on polling cookies at high frequencies

i'm sure it doesn't work like that anymore but, fuck

it was so janky and so cool

doesn't work if some pages are on a custom domain... but i'm fairly sure they could make it work with a hidden iframe

now i am reminded of how shit the document.cookie "api" is

thankfully there are no good reasons to use it these days

by the way this train of thought was prompted by this http 203 episode youtube.com/watch?v=9UNwHmaged

the modern way to do this would be with a serviceworker passing messages around. the utopic future way to do it if/when safari supports it is BroadcastChannel

i'm sure you will be surprised to find out that they don't mention "cookie polling"

@codl jesus fuck this is cursed, I can't wait to share it on our work slack tomorrow

@codl I'll tell them I found a cool way we can move all of our inherited graphql queries into innocuous looking network traffic to a keep-alive endpoint by embedding the queries in cookies. they'll go apeshit.

@codl if only there were some method of sending messages between web browser tabs

@ben there wasn't at the time i first found this (which is why it was impressive)

also it is still not exactly straightforward

@codl browsers hate cookies in iframes. that way only leads to pain.

@codl So they key is to call window.parent.postMessage, which allows you to send the message from the iframe to the document load embeds the iframe?

I'm still trying to get my head around why this isn't a security problem.

food 

@codl I love cookie polling

Which do you like more?
⚪ Chocolate Chip cookies
⚪ Sugar cookies

Sign in to participate in the conversation
Chitter

Chitter is a social network fostering a friendly, inclusive, and incredibly soft community.