I was looking at some facebook XHR request. I seen that there is a request that is cross domain, and the response is a JSON like:
for (;;); {/* JSON object */}
Why that response starts with a for???
I think it is related to some security reason, can someone explain me it?
Thanks
This is done to protect against XSS.
If a malicious site includes that JSON URL in a
<script>tag, the browser will freeze.The actual client site can just strip the prefix; other sites cannot, because of the Same-Origin Policy.