Edit in GitHubLog an issue

window.fetch(input, [init])

Fetches a resource from the network.

Returns: Promise<Response> Promise that resolves to a Response object.
Throws:

  • TypeError If init.body is set and init.method is either "GET" or "HEAD".
  • TypeError If either network error or network time-out occurs after a http request is made.
  • TypeError If there is a failure in reading files in FormData during posting FormData.

In order to leverage fetch, update the manifest.json with the network.domains permission shown below.

Example:
Copied to your clipboard
1{
2 "permissions": {
3 "network": {
4 "domains": [
5 "https://www.adobe.com",
6 "https://*.adobeprerelease.com",
7 "wss://*.myplugin.com"
8 ]
9 }
10 }
11}
Limitation:From UXP v7.4.0 onwards `permissions.network.domains` does not support wildCards in top-level domains.Example:
Copied to your clipboard
"domains": [ "https://www.adobe.*", "https://www.*" ]

See: Headers, Request and Response

ParamTypeDescription
input
string | Request
Either the URL string to connect with or a Request object having the URL and the init option.
[init]
Object
(Optional) Custom settings for a HTTP request.
[init.method]
string
HTTP request method. The default value is "GET".
[init.headers]
Headers
HTTP request headers to add.
[init.body]
string | ArrayBuffer | TypedArray | Blob | FormData | ReadableStream | URLSearchParams
Body to add to HTTP request.
[init.credentials]
string
Indicates whether to send cookies. The default value is "include". Possible values and functions are as follows:
  • "omit" : cookies are NOT sent.
  • "include" : cookies are sent.
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.