PresentationRequest: getAvailability() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

When the getAvailability() method is called, the user agent MUST run the following steps:

Input

presentationUrls, a list of presentation request URLs

Output

P, a Promise

  1. If one of the following conditions is true:

    Run the following substeps:

    1. Return a Promise rejected with a SecurityError DOMException.
    2. Abort these steps.
  2. Let P be a new Promise.

  3. Return P, but continue running these steps in parallel.

  4. If the user agent is unable to monitor the list of available presentation displays for the entire duration of the controlling browsing context (e.g., because the user has disabled this feature), then:

    1. Resolve P with a new PresentationAvailability object with its value property set to false.
    2. Abort all the remaining steps.
  5. If the user agent is unable to continuously monitor the list of available presentation displays but can find presentation displays in order to start a connection, then:

    1. Reject P with a NotSupportedError DOMException.
    2. Abort all the remaining steps.
  6. If there exists a tuple (A, presentationUrls) in the set of availability objects, then:

    1. Resolve P with A.
    2. Abort all the remaining steps.
  7. Let A be a new PresentationAvailability object with its value property set as follows:

    1. false if the list of available presentation displays is empty.
    2. true if there is at least one compatible presentation display for some member of presentationUrls. Meaning there is an entry (presentationUrl, display) in the list of available presentation displays for some presentationUrl in presentationUrls.
    3. false otherwise.
  8. Create a tuple (A, presentationUrls) and add it to the set of availability objects.

  9. Run the algorithm to monitor the list of available presentation displays.

  10. Resolve P with A.

Specifications

Specification
Presentation API
# getting-the-presentation-displays-availability-information

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getAvailability
Experimental
Chrome – Full support
Chrome 47 (Release date: 2015-12-01)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 34 (Release date: 2015-12-08)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 47 (Release date: 2015-12-02)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 34 (Release date: 2015-12-16)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 5 (Release date: 2016-12-15)
footnote Full support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.