fetch-jsonp-polyfill支持 jsonp 的Fetch polyfill
fetch-jsonp-polyfill 是对原生 Fetch API 的扩展,使之支持 jsonp。
下载地址 https://github.com/fetch-extras/fetch-jsonp-polyfill
几乎所有主流的 jsonp polyfill 库兼容,如https://github.com/github/fetch、https://github.com/matthew-andrews/isomorphic-fetch 、https://github.com/bitinn/node-fetch
安装
使用 npm
npm install fetch-jsonp-polyfill --save-dev
引用
require('isomorphic-fetch') require('fetch-jsonp-polyfill') or import 'whatwg-fetch' import 'fetch-jsonp-polyfill'
使用
fetch('http://jsfiddle.net/echo/jsonp/?hello=world', { method: "JSONP" }) .then(res => res.json()) .then(data => { console.log(data); }) .catch(err => { console.log(err); })
其它选项
fetch(URL, { method: 'JSONP', timeout: 5000, callback: 'callback', callbackName: 'fetchjsonp_callback', })
浏览器支持
Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | 6.1+ ✔ |
评论
Fetchwindow.fetch 的 JavaScript polyfill
Fetch 是 window.fetch 的 JavaScript polyfill。全局 fetc
Fetchwindow.fetch 的 JavaScript polyfill
0
Fetchwindow.fetch 的 JavaScript polyfill
Fetch是window.fetch的JavaScriptpolyfill。全局fetch函数是web请求和处理响应的简单方式,不使用XMLHttpRequest。这个polyfill编写的接近标准的
Fetchwindow.fetch 的 JavaScript polyfill
0
WebAssembly Polyfill展示 polyfill 可行性原型
WebAssemblyPolyfill包括用于展示WebAssemblypolyfill可行性的原型。其他库中用于设计实际标准二进制格式的工作正在进行中。此库也没有在本地浏览器进行解码,所以从技术上讲
WebAssembly Polyfill展示 polyfill 可行性原型
0
WebAssembly Polyfill展示 polyfill 可行性原型
WebAssembly Polyfill 包括用于展示 WebAssembly polyfill 可
WebAssembly Polyfill展示 polyfill 可行性原型
0
Fetch HTTP Client基于 Fetch API 封装的 HTTP Client
一个基于FetchAPI封装的HTTPClient,可用于浏览器及其他兼容环境中,设计之初是为了ReactJS和ReactNative访问后端RestAPI使用。比其他基于FetchAPI的封装优势在
Fetch HTTP Client基于 Fetch API 封装的 HTTP Client
0
Fetch HTTP Client基于 Fetch API 封装的 HTTP Client
一个基于 Fetch API 封装的 HTTP Client,可用于浏览器及其他兼容环境中,设计之初
Fetch HTTP Client基于 Fetch API 封装的 HTTP Client
0
JSONP浏览器安全模型规定
JSONP(JSONwithPadding)是资料格式JSON的一种“使用模式”,可以让网页从别的网域获取资料。另一个解决这个问题的新方法是跨来源资源共享。浏览器安全模型规定,XMLHttpReque
JSONP浏览器安全模型规定
0