A polyfill that adds JSONP support to the Fetch API by allowing method: 'JSONP' in fetch options. Current stable version is 1.1.5 (not updated since 2016). It wraps existing fetch polyfills like github/fetch, isomorphic-fetch, or node-fetch and must be imported after them. Unlike alternatives, it does not expose a separate JSONP function but monkey-patches the global fetch to transparently handle JSONP requests when the method is set to 'JSONP'. Supports common JSONP options: timeout, callback query parameter name, and callback function name.
npm install fetch-jsonp-polyfillNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use the polyfill: import after a base fetch polyfill, then call fetch with method:'JSONP' and optional JSONP-specific options.
Consider using a maintained solution like fetch-jsonp (npm package 'fetch-jsonp') which exports a standalone function.
Ensure any fetch polyfill (e.g., isomorphic-fetch, whatwg-fetch) is imported first.
Only use JSONP with trusted third-party APIs; prefer CORS-enabled endpoints and standard fetch.
If using in Node, install and import node-fetch before this polyfill. Read README for compatible polyfills.
Install and import a fetch polyfill before fetch-jsonp-polyfill: import 'isomorphic-fetch'; import 'fetch-jsonp-polyfill';
You may need to parse the response manually or use a different library that handles JSONP response extraction.