Registry / testing / fetch-detector

fetch-detector

JSON →
library1.0.1jsnpmunverified

Detects incomplete Fetch API support (e.g., Chrome <46, Firefox <39 where response text encoding is broken) and disables native fetch, falling back to XHR polyfills. v1.0.1 – last release dated 2016. Minimal, zero-dependency bundler-friendly utility; must be used with fetch-ie8 (imported before it). Differentiates from generic fetch polyfills by conditionally enabling native fetch only on fully compliant browsers, preventing silent data corruption due to Chinese character encoding bugs.

npm install fetch-detector
INSTALL
IMPORT
SIG · FETCH-DETECTOR
F
fetch-detector
testingjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fetch-detector
import 'fetch-detector'
import fetchDetector from 'fetch-detector'
This package is a side-effect-only module. It must be imported before fetch-ie8, and does not export anything. Do not use default or named imports.

Shows the correct import order: first fetch-detector, then fetch-ie8, to conditionally enable native fetch or fallback to XHR polyfill.

// Install: npm install fetch-detector fetch-ie8 import 'fetch-detector' import 'fetch-ie8' // Then use fetch normally – it will use native fetch on Chrome >=46 and Firefox >=39, otherwise XHR fetch('https://api.example.com/data') .then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error(err))
Debug
Known issues
deprecatedPackage is unmaintained since 2016. It only handles Chrome/Firefox bugs from 2015 and does not address modern browser quirks.
fix
Consider using a modern fetch polyfill like 'whatwg-fetch' or rely on browser built-in fetch (now widely supported).
affects: >=1.0.0
gotchaMust be imported before fetch-ie8. Reversing the order will cause the detector to not work correctly.
fix
Always place 'fetch-detector' import before 'fetch-ie8' import.
affects: *
gotchaDoes not ship TypeScript type definitions; using in a TS project may require a declaration file.
fix
Create a custom declaration file: declare module 'fetch-detector';
affects: *
Errors
Common errors & fixes
Uncaught TypeError: Failed to fetch
Native fetch used on a browser with broken encoding (e.g., Chrome 45) because fetch-detector was not imported or was imported after the polyfill.
fix
Ensure 'fetch-detector' is imported before 'fetch-ie8' and that both are included in your bundle.
Cannot find module 'fetch-detector'
Missing npm install of fetch-detector or incorrect import path.
fix
Run 'npm install fetch-detector' and verify import is 'import "fetch-detector"' (not from a subpath).
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
fetch-detector — npm install fetch-detector · libregistry