A library that provides a JSONP fetch API similar to the standard Fetch API, with support for custom callback parameter names, callback function names, timeouts, fetchPriority, and crossorigin attributes. Version 1.4.0 is the latest stable release. It is lightweight and aims to fill the gap where standard Fetch does not support JSONP. Suitable for older browsers or APIs that still use JSONP, with built-in TypeScript types.
npm install fetch-jsonpNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Simple JSONP fetch with custom callback parameter and timeout, parsing JSON response.
Use standard fetch or XMLHttpRequest for POST requests.
Use jsonpCallback to set the query parameter name, and avoid manually setting jsonpCallbackFunction unless you have a fixed callback function name requirement.
Only use response.json() to parse the JSONP response. Do not call response.text(), response.blob(), etc.
Upgrade to >=1.0 and migrate code to use the promise-based API with .then() and .catch().
Ensure the JSONP endpoint URL is the final URL (no redirects) or handle redirects on the server side.
Use import fetchJsonp from 'fetch-jsonp' for ES modules, or const fetchJsonp = require('fetch-jsonp') for CommonJS (Node handles interop).Only call response.json() on the returned response.
Verify the URL is correct and the server returns a valid JSONP response (callback wrapped). Check for CORS issues or network connectivity.
Ensure the server responds with the expected callback function name (e.g., jsonp_xxxx). Use jsonpCallback option to set the query parameter name that the server expects.
No dependency data recorded yet.