PresentationRequest: getAvailability() method
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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
- If one of the following conditions is true:
- The result of running the prohibits mixed security contexts algorithm on the document's settings object is
"Prohibits Mixed Security Contexts"
and presentationUrl is an a priori unauthenticated URL. - The document object's active sandboxing flag set has the sandboxed presentation browsing context flag set.
- Return a Promise rejected with a
SecurityError
DOMException
. - Abort these steps.
- The result of running the prohibits mixed security contexts algorithm on the document's settings object is
- Let P be a new Promise.
- Return P, but continue running these steps in parallel.
- 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:
- Resolve P with a new
PresentationAvailability
object with itsvalue
property set tofalse
. - Abort all the remaining steps.
- Resolve P with a new
- 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:
- Reject P with a
NotSupportedError
DOMException
. - Abort all the remaining steps.
- Reject P with a
- If there exists a tuple (A, presentationUrls) in the set of availability objects, then:
- Resolve P with A.
- Abort all the remaining steps.
- Let A be a new
PresentationAvailability
object with itsvalue
property set as follows:false
if the list of available presentation displays is empty.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.false
otherwise.
- Create a tuple (A, presentationUrls) and add it to the set of availability objects.
- Run the algorithm to monitor the list of available presentation displays.
- Resolve P with A.
Browser compatibility
BCD tables only load in the browser