PopClip JavaScript API Reference
    Preparing search index...

    Class XMLHttpRequest

    Makes an HTTP request. PopClip implements the subset of the Web API declared here; there is no fetch().

    Requires the network entitlement. Most extensions use the bundled axios library, which is built on this.

    const xhr = new XMLHttpRequest();
    xhr.open("GET", "https://example.com/", true);
    xhr.onload = () => print(xhr.status, xhr.responseText);
    xhr.send();
    Index
    readyState: number

    Request state: 0 unsent, 1 opened, 2 headers received, 3 loading, 4 done.

    response: any

    The response body, decoded according to responseType.

    responseText: string

    The response body as text.

    responseType: string

    How to interpret the response body, e.g. "text", "json", "blob".

    responseURL: string

    The final URL, after any redirects.

    status: number

    HTTP status code.

    statusText: string

    HTTP status message.

    timeout: number

    Timeout in milliseconds. 0, the default, means no timeout.

    • Aborts the request.

      Returns void

    • All response headers as a single string, with lowercased names.

      Returns string

    • A single response header, or null if not present.

      Parameters

      • name: string

      Returns string | null

    • Initializes the request.

      Parameters

      • httpMethod: string
      • url: string
      • Optionalasync: boolean

      Returns void

    • Sends the request, with an optional body.

      Parameters

      • Optionalbody: string | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | Blob | null

      Returns void

    • Sets a request header. Call after open and before send.

      Parameters

      • name: string
      • value: string

      Returns void