Generated by GPT-5-mini| JSONP | |
|---|---|
![]() hij1nx · Public domain · source | |
| Name | JSONP |
| Programming language | JavaScript |
| Genre | Data interchange / Web technology |
JSONP
JSONP is a web technique for requesting data by exploiting the ability of browsers to load script resources from third-party origins. It was widely used to perform cross-origin data exchange before standardized cross-origin mechanisms became prevalent. JSONP appears in discussions of web development, browser security, and web APIs and interacts with many projects and institutions involved in web standards.
JSONP enables a web page served from one origin to obtain data from another origin by inserting a HTML <script> element whose source points to a remote endpoint that responds with a JavaScript callback invocation. It relies on the same-origin exception for Content Delivery Network script loading observed in browsers like Netscape Navigator, Internet Explorer, Mozilla Firefox, Google Chrome, and Safari. Developers historically used JSONP with services such as Twitter, Flickr, Facebook, Google Maps, and Yahoo! to integrate cross-site resources before Cross-Origin Resource Sharing existed.
JSONP emerged as a pragmatic workaround during the era of early 2000s browser inconsistency and proprietary features. Engineers at organizations including Netflix, Google, Yahoo!, and smaller startups adopted it alongside practices from projects like jQuery and Prototype to enable mashups popularized by events such as the Web 2.0 movement. As browsers evolved through versions of Mozilla and WebKit, demands from platforms such as Amazon and eBay drove adoption of server endpoints that emitted callback-wrapped payloads to satisfy cross-site scripting constraints and enable interactive widgets.
A JSONP response is syntactically valid JavaScript: a named function call whose argument is a JSON value. Clients inject a