reconnect

When the reconnect(presentationId) method is called on a PresentationRequest presentationRequest, the user agent MUST run the following steps to reconnect to a presentation:

Input
presentationRequest, the PresentationRequest object that reconnect() was called on.
presentationId, a valid presentation identifier
Output
P, a Promise
  1. Using the document's settings object run the prohibits mixed security contexts algorithm.
  2. If the result of the algorithm is "Prohibits Mixed Security Contexts" and the presentation request URL of presentationRequest is an a priori unauthenticated URL, then return a Promise rejected with a SecurityError and abort these steps.
  3. If the document object's active sandboxing flag set has the sandboxed presentation browsing context flag set, then return a Promise rejected with a SecurityError and abort these steps.
  4. Let P be a new Promise.
  5. Return P but continue running these steps in parallel.
  6. Search the set of controlled presentations for a PresentationConnection that meets the following criteria: its controlling browsing context is the current browsing context, its presentation connection state is not terminated, its presentation URL is equal to one of the presentation request URLs of presentationRequest and its presentation identifier is equal to presentationId.
  7. If such a PresentationConnection exists, run the following steps:
    1. Let S be that PresentationConnection.
    2. Resolve P with S.
    3. If the presentation connection state of S is connecting or connected, then abort all remaining steps.
    4. Set the presentation connection state of S to connecting.
    5. Establish a presentation connection with S.
    6. Abort all remaining steps.
  8. Search the set of controlled presentations for the first PresentationConnection that meets the following criteria: its presentation connection state is not terminated, its presentation URL is equal to one of the presentation request URLs of presentationRequest, and its presentation identifier is equal to presentationId.
  9. If such a PresentationConnection exists, let E be that PresentationConnection, and run the following steps:
    1. Create a new PresentationConnection S.
    2. Set the presentation identifier of S to presentationId.
    3. Set the presentation URL of S to the presentation URL of E.
    4. Set the presentation connection state of S to connecting.
    5. Add S to the set of controlled presentations.
    6. Resolve P with S.
    7. Queue a task to fire a trusted event with the name connectionavailable, that uses the PresentationConnectionAvailableEvent interface with the connection attribute initialized to S, at presentationRequest. The event must not bubble and cancelable and should have no default action.
    8. Establish a presentation connection with S.
    9. Abort all remaining steps.
  10. Reject P with a NotFoundError exception.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Experimental
Chrome Full support 48Edge ? Firefox Full support 51
Disabled
Full support 51
Disabled
Disabled From version 51: this feature is behind the dom.presentation.controller.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE ? Opera Full support 35Safari ? WebView Android Full support 48Chrome Android Full support 48Edge Mobile ? Firefox Android Full support 51
Disabled
Full support 51
Disabled
Disabled From version 51: this feature is behind the dom.presentation.controller.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 35Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
User must explicitly enable this feature.

Document Tags and Contributors

Contributors to this page: lucian95, PushpitaPikuDey, MashKao
Last updated by: lucian95,