首页 时政热点 科技头条 智能AI 安全攻防 数码硬件 开发者生态 汽车 游戏 社会热点 开源推荐 医疗健康 归档 标签 关于

GitHub热门项目: fetch

摘要

GitHub项目:fetch 仓库地址:https://github。com/polyfillpolyfill/fetch Stars:684 | 作者:polyfillpolyfill 项目描述:A window。fetch JavaScript polyfill。

fetch the this you for
2026-06-30 1 阅读 约10分钟阅读 GitHub Trending
分享:
字号:
GitHub项目:fetch 仓库地址:https://github.com/polyfillpolyfill/fetch Stars:684 | 作者:polyfillpolyfill 项目描述:A window.fetch JavaScript polyfill. ================================================== README 内容: # window.fetch polyfill [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/JakeChampion/fetch/badge)](https://securityscorecards.dev/viewer/?uri=github.com/JakeChampion/fetch) The `fetch()` function is a Promise-based mechanism for programmatically making web requests in the browser. This project is a polyfill that implements a subset of the standard [Fetch specification][], enough to make `fetch` a viable replacement for most uses of XMLHttpRequest in traditional web applications. ## Table of Contents * [Read this first](#read-this-first) * [Installation](#installation) * [Usage](#usage) * [Importing](#importing) * [HTML](#html) * [JSON](#json) * [Response metadata](#response-metadata) * [Post form](#post-form) * [Post JSON](#post-json) * [File upload](#file-upload) * [Caveats](#caveats) * [Handling HTTP error statuses](#handling-http-error-statuses) * [Sending cookies](#sending-cookies) * [Receiving cookies](#receiving-cookies) * [Redirect modes](#redirect-modes) * [Obtaining the Response URL](#obtaining-the-response-url) * [Aborting requests](#aborting-requests) * [Browser Support](#browser-support) ## Read this first * If you believe you found a bug with how `fetch` behaves in your browser, please **don't open an issue in this repository** unless you are testing in an old version of a browser that doesn't support `window.fetch` natively. Make sure you read this _entire_ readme, especially the [Caveats](#caveats) section, as there's probably a known work-around for an issue you've found. This project is a _polyfill_, and since all modern browsers now implement the `fetch` function natively, **no code from this project** actually takes any effect there. See [Browser support](#browser-support) for detailed information. * If you have trouble **making a request to another domain** (a different subdomain or port number also constitutes another domain), please familiarize yourself with all the intricacies and limitations of [CORS][] requests. Because CORS requires participation of the server by implementing specific HTTP response headers, it is often nontrivial to set up or debug. CORS is exclusively handled by the browser's internal mechanisms which this polyfill cannot influence. * This project **doesn't work under Node.js environments**. It's meant for web browsers only. You should ensure that your application doesn't try to package and run this on the server. * If you have an idea for a new feature of `fetch`, **submit your feature requests** to the [specification's repository](https://github.com/whatwg/fetch/issues). We only add features and APIs that are part of the [Fetch specification][]. ## Installation ``` npm install whatwg-fetch --
这篇文章对您有帮助吗?

订阅66必读

每日精选科技资讯,直达你的邮箱