The JSONP approach is necessitated, as I mentioned by the browsers' SOP (Same-origin policy) which prohibits XMLHttpRequests from crossing domains.
There are three ways to make cross domain calls
1. Using Local Proxy : We send the request to another service side page(like php,jsp etc) that makes a request from the server to the web service. But this ultimately result in double bandwidth and latency
2. Flash : NEED Flash
3. Script tag (JSON with Padding. JSONP approach) injection: I am only left with this approach of creating script tag dynamically and setting src attribute to a web service API call. It can be considered as security risk.
Yahoo Using same approach
Article: http://developer.yahoo.com/common/json.html#callbackparam
Example request: http://api.local.yahoo.com/MapsService/V1/geocode?appid=dantheurer&location=la&output=json&callback=getLocation
Delicious is also using JSONP approach
http://feeds.delicious.com/feeds/json/bob/javascript+hack?jsonp=delicious_callbacks%5B12345%5D
Google also uses same approach. I read it in this thread.
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/1e1cecf679dd7c5a
So, google api also uses JSONP(i.e the same script tag hack) approach
Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts
Wednesday, February 27, 2008
Monday, December 17, 2007
2007 Ajax Tools Usage Survey Results
Source: Ajaxian
"Prototype and Script.aculo.us are the only toolkits to maintain a lead over the past three years. However, over all there are no clear winners or losers as even the strongest incumbents (i.e., Prototype and Script.aculo.us) are starting too loose ground. Some frameworks initially popular have faded nearly completely out of the market (i.e., xajax and Rico ) while others have have sprung out of nowhere to become leading tookits (i.e., jQuery and Ext JS). The changes over the past three years are easy to see in the stack chart at the end of this blog, which shows the market share of the most popular toolkits - notice how they grow and shrink in market share. That means that the market remains immature."
Subscribe to:
Posts (Atom)