Topic: CORS policy and JSONP

Posted under e621 Tools and Applications

i am trying to use the api from JS in the browser. For security reasons it is impossible to send requests to other sites. To bypass this it's possible to use jsonp, which the api already provides, but with jsonp it is impossible to send a user agent, which is required in the docs. If CORS is implemented in the site it would be possible to do a normal request from JS without the need to use jsonp and it will be possible to use an user agent.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Updated by KiraNoot

I don't know what you said but I do know you were speaking in circles

Updated by anonymous

Versperus said:
I don't know what you said but I do know you were speaking in circles

No, he was speaking in webdev.

Updated by anonymous

I have updated the recommendation based on how JSONP works. You can include a url query param named _client and place your desired user-agent in that parameter. For instance /post/index.json?_client=MyCoolClient%20by%20Kira%20on%20e6

Updated by anonymous

  • 1