Difference between revisions of "JSONp"
Line 82: | Line 82: | ||
* Making Media API Calls with Dynamic Script Tags (JSONp): http://support.brightcove.com/en/docs/making-media-api-calls-dynamic-script-tags | * Making Media API Calls with Dynamic Script Tags (JSONp): http://support.brightcove.com/en/docs/making-media-api-calls-dynamic-script-tags | ||
* Cross-domain communications with JSONP, Part 2: Building mashups with JSONP, jQuery, and Yahoo! Query Language: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp2/ | * Cross-domain communications with JSONP, Part 2: Building mashups with JSONP, jQuery, and Yahoo! Query Language: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp2/ | ||
− | + | * How to access cross-domain data with AJAX using JSONP, jQuery and PHP: http://www.fbloggs.com/2010/07/09/how-to-access-cross-domain-data-with-ajax-using-jsonp-jquery-and-php/ | |
Revision as of 20:18, 4 June 2012
JSON with Padding (commonly abbreviated JSONP) is a JSON extension wherein a prefix is specified as an input argument of the call itself. This padding prefix is typically the name of a callback function, but may also be a variable assignment, an if statement, or any other Javascript statement prefix. The original proposition appears to have been made in the MacPython blog in 2005 [17] and is now used by many Web 2.0 applications such as Dojo Toolkit Applications, Google Toolkit Applications[18] and Web Services. Further extensions of this protocol have been proposed by considering additional input arguments as, for example, is the case of JSONPP[1] supported by S3DB web services.
Because JSONP makes use of script tags, calls are essentially open to the world. For that reason, JSONP may be inappropriate to carry sensitive data.[20]
Including script tags from remote sites allows the remote sites to inject any content into a website. If the remote sites have vulnerabilities that allow JavaScript injection, the original site can also be affected.[2]
Contents
EXAMPLES
BC$ MobileTV
oEmbed - JSON endpoint:
http://bcmoney-mobiletv.com/1744/oembed/json
oEmbed - special JSONp endpoint (direct):
http://bcmoney-mobiletv.com/1744/oembed/json&callback=displayResults
YouTube
- YouTube video widget (via JSONp): http://bcmoney-mobiletv.com/youtube/
- YouTube AJAX API integration (video/playlist search): http://www.yvoschaap.com/youtube.html
- Developer's Guide -- JSON-C / JavaScript: http://code.google.com/apis/youtube/2.0/developers_guide_jsonc.html
- (Interactive test tool) Understanding the YouTube API's JSON-C responses: http://code.google.com/apis/youtube/articles/view_youtube_jsonc_responses.html
- YouTube JavaScript Player API Reference: http://code.google.com/apis/youtube/js_api_reference.html
Flickr
- Flickr image widget (via JSONp): http://bcmoney-mobiletv.com/widgets/flickr/
- Flickr AJAX API integration (photo/photoset search): http://kylerush.net/javascript/tutorial-flickr-api-javascript-jquery-ajax-json-build-detailed-photo-wall/
Last.fm
- Last.FM audio widget (via JSONp): http://bcmoney-mobiletv.com/widgets/lastfm/
- Last.fm Web Services: http://www.last.fm/api/show?service=286
- Last.fm JSON/JSONp Web Service Extensions: http://lastfm-api-ext.appspot.com/docs/
- Last.FM - Recent Tracks widget (using jQuery and JSONp): http://wordpress.org/extend/plugins/lastfm-recent-tracks-widget/
- Twitter real-time messaging widget (via JSONp): http://bcmoney-mobiletv.com/widgets/twitter/
- Twitter JSON/JSONP API URL: http://jquery-howto.blogspot.com/2009/04/twitter-jsonjsonp-api-url.html
- Creating a live Twitter status update with YQL and JavaScript: http://www.bukisa.com/articles/206910_creating-a-live-twitter-status-update-with-yql-and-javascript
- Facebook social networking widget (via JSONp): http://bcmoney-mobiletv.com/widgets/facebook/
- JavaScript SDK: http://developers.facebook.com/docs/reference/javascript/
- Graph Api & Javascript Base Facebook Connect Tutorial: http://thinkdiff.net/facebook/graph-api-javascript-base-facebook-connect-tutorial/
- New Facebook Javascript API: http://blog.toppingdesign.com/2010/04/26/new-facebook-javascript-api/
- JavaScript-Based Authentication: http://developers.facebook.com/docs/authentication/javascript[3][4][5][6]
Yahoo
- Yahoo! Term Extractor widget: http://bcmoney-mobiletv.com/widgets/yahoo/
- Yahoo! web-wide proxy content scraper widget (via YQL and JSONp):
- Using YQL with JSONP: http://james.padolsey.com/javascript/using-yql-with-jsonp/
- YQL console: http://developer.yahoo.com/yql/console/
- Google web search widget (via JSONp): http://bcmoney-mobiletv.com/google/
- Google Search AJAX API: http://code.google.com/apis/websearch/ (formerly http://code.google.com/apis/ajaxsearch/)
- Google Feed API — Now with instant gratification: http://googleajaxsearchapi.blogspot.com/2010/05/google-feed-api-now-with-instant.html
Wikipedia
- Wikipedia encyclopedia article search widget (via YUI + JSONp): http://bcmoney-mobiletv.com/widgets/wikipedia/
- MediaWiki API docs: http://en.wikipedia.org/w/api.php
Tools
- JSONPify - a simple way to access feeds and web services from a client based web application: http://jsonpify.com/
Tutorials
- JSON and the Dynamic Script Tag: Easy, XML-less Web Services for JavaScript: http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html
- Remote JSON - JSONP: http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/
- Making Media API Calls with Dynamic Script Tags (JSONp): http://support.brightcove.com/en/docs/making-media-api-calls-dynamic-script-tags
- Cross-domain communications with JSONP, Part 2: Building mashups with JSONP, jQuery, and Yahoo! Query Language: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp2/
- How to access cross-domain data with AJAX using JSONP, jQuery and PHP: http://www.fbloggs.com/2010/07/09/how-to-access-cross-domain-data-with-ajax-using-jsonp-jquery-and-php/
External Links
- JSONP -- JSON With Padding: http://ajaxian.com/archives/jsonp-json-with-padding
- JSON to JSONP -- Bypass Same-Origin Policy: http://www.codeproject.com/KB/aspnet/JSONToJSONP.aspx
- Cross domain AJAX querying with jQuery: http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html
- Loading external content with Ajax using jQuery and YQL: http://www.wait-till-i.com/2010/01/10/loading-external-content-with-ajax-using-jquery-and-yql/
- Cross-domain requests with jQuery and Google: http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
- Cross-domain RSS to JSON converter [jQuery plugin]: http://jquery-howto.blogspot.com/2009/11/cross-domain-rss-to-json-converter.html
- Sandbox Your Cross Domain JSONP To Improve Mashup Security, by BeeBole: http://es-es.facebook.com/note.php?note_id=88263014240
- XML to JSONML Client-side (Flash .swf) Proxy: http://synaptify.com/?p=19592
- Mocking Facebook Connect Javascript API: http://www.ajaxlines.com/ajax/stuff/article/mocking_facebook_connect_javascript_api.php
- MEGAUPLOADから簡単にダウンロード (download MegaUpload videos easily): http://hail2u.net/blog/coding/fast-megaupload.html
References
- ↑ Almeida, Jonas (June 11, 2008). "JSON, JSONP, JSONPP?". S3DB: http://sites.google.com/a/s3db.org/s3db/documentation/mis/json-jsonp-jsonpp. Retrieved April 26, 2009.
- ↑ wikipedia: JSONP#JSONP
- ↑ Facebook Connect JavaScript SDK: http://github.com/facebook/connect-js
- ↑ Facebook JavaScript Client Library: http://wiki.developers.facebook.com/index.php/JavaScript_Client_Library
- ↑ Old JavaScript SDK: http://developers.facebook.com/docs/reference/oldjavascript/
- ↑ Building a Better Photo Uploader (with JSONp): http://www.facebook.com/note.php?note_id=178492968919
- ↑ Cross-domain communications with JSONP, Part 1 -- Combine JSONP and jQuery to quickly build powerful mashups: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp1/index.html
- ↑ Cross-domain communications with JSONP, Part 2 -- Building mashups with JSONP, jQuery, and Yahoo! Query Language: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp2/index.html
- ↑ YQL and JSONP-X (aka. json-p-x, jsonpx, json-px): http://paul.donnelly.org/2009/07/08/yql-and-jsonp-x/
- ↑ Mashups with JSONP, jQuery and YQL: http://projects.ischool.washington.edu/tabrooks/343INFOAutumn09/JSONP/jsonpJqueryYQL.htm
See Also
JSON | AJAX | jQuery | JavaScript | XSS