ajax - JSONP question for making PUT/POST/DELETE cross-domain requests -
i've created restful api supports get/post/put/delete requests. want api have javascript client library, , thought use jsonp bypass cross-domain policy. works, of course requests.
so started thinking how implement such thing , @ same time trying make painless use.
i thought edit api implementation , check every http request. if it's jsonp requests (it has "callback" parameter in querystring) force every api method executed request, if should called other methods post or delete.
this not restful approach problem, works. think?
maybe solution dynamically generate iframe send non-get requests. tips?
there's relevant points on pretty similar question here...
the cross-domain restrictions there reason ;-)
jsonp allows expose limited, safe, read-only view of api cross domain access - if subvert you're potentially opening huge security hole - malicious websites can make destructive calls api including image href pointing right part of api
having webapp expose functionality accessed through iframes, ajax occurs within context of webapp's domain safer choice. still need take csrf consideration. (take @ django's latest security announcement on django blog prime example - of release week javascript calls django webapp must csrf validated default)
Comments
Post a Comment