Invalid javascript/JSONP response from Soundcloud API

自作多情 提交于 2019-12-11 11:41:29

问题


When I include this url as a <script> in my HTML document, Chrome does not call my callback function, whereas it works perfectly for other urls returned by soundcloud's resolve api.

After a long investigation using Chrome Dev Tools, I finally found out that the javascript returned by that call fires a SyntaxError (cf the screenshot below).

How can I get my callback function to be called as usual for that file?


回答1:


DevTools actually pinpoint the issue:

There is an unallowed character (\u2028) in the response. SoundCloud messed up sanitizing that. This JSONP response is invalid in all browsers.

To work around it, you can simply fetch the JSON file directly. SoundCloud CORS setup seems to allow that.



来源:https://stackoverflow.com/questions/28094214/invalid-javascript-jsonp-response-from-soundcloud-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!