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...

jsonp implications true rest

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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -