2 ms·
This is why Google, Facebook, and others prepend JSON responses with while(1){}. Any browser trying to eval it will get stuck in an infinite loop, protecting th
by zwily 14y ago
This is why Google, Facebook, and others prepend JSON responses with while(1){}. Any browser trying to eval it will get stuck in an infinite loop, protecting the payload. That's what they did a couple years ago at least. It looks like gmail is now prepending with )]}' for some JSON calls instead.
- Zarel 14y agoI've been prepending with ], which as far as I know is enough to make any JSON data into a syntax error... is there a reason why these companies use longer things?
- zwily 14y agoI don't know. It looks like they're prepending some responses with )]}' now, which would cause a syntax error as well.