Why while(1); , for(;;); as the prefix of a REST Webservices response?

Posted: Wednesday, January 12, 2011 by Venkat Pola in Labels:

Most of the REST web services JSON response will be like

while(1);{"feedItem": "sdf","status": "sdfsdf","updateTime": "sdfsdf"}

Just go through the HTTP calls made inside in Facebook, Google calender, Chatter ..etc then you can find such responses.

while(1); , for(;;); all these are infinite loops, this is ensure that some other websites cant hack other sites data. By using this we can prevent Cross domain AJAX requests made using script tags.

Enhanced by Zemanta


  1. Gajendra says:

    Nice information Venki.

  1. Venki says:

    Thanks Gajendra.. Nice to see your comment.