Best content type to serve JSONP?

Zach picture Zach · Sep 21, 2008 · Viewed 49.8k times · Source

I have a webservice that when called without specifying a callback will return a JSON string using application/json as the content type.

When a callback is specified it will wrap the JSON string in a callback function, so it's not really valid JSON anymore. My question is, should I serve it as application/javascript in this case or still use application/json?

Answer

John Millikin picture John Millikin · Sep 21, 2008

Use application/javascript. In that way, clients can rely on the content-type without having to manually check whether a response has padding or not.