5

just curious about https://medium.com I see that on their search page they make an automatic ajax GETrequest, I opened up my firebug(cause of curiosity) and get results as follows:

(I typed the search phrase sen to trigger GET request to https://medium.com/search/all?q=sen. Note if you opened it, it won't work since it only expects ajax request)

])}while(1);</x>{"success":true,"payload":{"value":{"posts":[{"id":"748b78360917","versionId":"9fbac25a3c7c","creatorId":"29fed3d34b82","homeCollectionId":"e196dfdf4b5d","title":"Nous sommes des clients, pas des usagers. Et ça change tout" // MORE JSON RESPONSE FROM SERVER....

now the question is not about the JSON part, I want to know what does ])}while(1);</x> mean in the response? What's the purpose of this?

Updated I know that while(1) is for infinite loop, but why doing this?

Update I read the similar question, now I know the use of 'while(1)' is to prevent json hijacking, but the ' ])}while(1);' part is still confusing, why use '])}' and '' ? Isn't 'while(1)' enough?

George Stocker
  • 55,025
  • 29
  • 167
  • 231
sendy halim
  • 355
  • 3
  • 9

0 Answers0