| 
 | 1 | +package org.scalajs.dom  | 
 | 2 | + | 
 | 3 | +import scala.scalajs.js  | 
 | 4 | + | 
 | 5 | +@js.native  | 
 | 6 | +trait NavigatorProtocolHandler extends js.Object {  | 
 | 7 | + | 
 | 8 | +  /** The Navigator method registerProtocolHandler() lets websites register their ability to open or handle particular  | 
 | 9 | +    * URL schemes (aka protocols).  | 
 | 10 | +    *  | 
 | 11 | +    * For example, this API lets webmail sites open mailto: URLs, or VoIP sites open tel: URLs.  | 
 | 12 | +    *  | 
 | 13 | +    * @see  | 
 | 14 | +    *   https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler  | 
 | 15 | +    *  | 
 | 16 | +    * @param scheme  | 
 | 17 | +    *   A string containing the permitted scheme for the protocol that the site wishes to handle. For example, you can  | 
 | 18 | +    *   register to handle SMS text message links by passing the "sms" scheme.  | 
 | 19 | +    * @param url  | 
 | 20 | +    *   A string containing the URL of the handler. This URL must include %s, as a placeholder that will be replaced  | 
 | 21 | +    *   with the escaped URL to be handled.  | 
 | 22 | +    * @return  | 
 | 23 | +    *   undefined  | 
 | 24 | +    *  | 
 | 25 | +    * @throws SecurityError  | 
 | 26 | +    *   DOMException: The user agent blocked the registration. This might happen if:  | 
 | 27 | +    *   - The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:,  | 
 | 28 | +    *     etc.)  | 
 | 29 | +    *   - The handler URL's origin does not match the origin of the page calling this API.  | 
 | 30 | +    *   - The browser requires that this function is called from a secure context.  | 
 | 31 | +    *   - The browser requires that the handler's URL be over HTTPS.  | 
 | 32 | +    *  | 
 | 33 | +    * @throws SyntaxError  | 
 | 34 | +    *   DOMException: The %s placeholder is missing from the handler URL  | 
 | 35 | +    */  | 
 | 36 | +  def registerProtocolHandler(scheme: String, url: String): Unit = js.native  | 
 | 37 | + | 
 | 38 | +  /** The Navigator method unregisterProtocolHandler() removes a protocol handler for a given URL scheme.  | 
 | 39 | +    *  | 
 | 40 | +    * This method is the inverse of registerProtocolHandler().  | 
 | 41 | +    *  | 
 | 42 | +    * @see  | 
 | 43 | +    *   https://developer.mozilla.org/en-US/docs/Web/API/Navigator/unregisterProtocolHandler  | 
 | 44 | +    *  | 
 | 45 | +    * @param scheme  | 
 | 46 | +    *   A string containing the permitted scheme in the protocol handler that will be unregistered. For example, you can  | 
 | 47 | +    *   unregister the handler for SMS text message links by passing the "sms" scheme.  | 
 | 48 | +    * @param url  | 
 | 49 | +    *   A string containing the URL of the handler. This URL should match the one that was used to register the handler  | 
 | 50 | +    *   (e.g. it must include %s).  | 
 | 51 | +    * @return  | 
 | 52 | +    *   undefined  | 
 | 53 | +    *  | 
 | 54 | +    * @throws SecurityError  | 
 | 55 | +    *   DOMException: The user agent blocked unregistration. This might happen if:  | 
 | 56 | +    *   - The registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:,  | 
 | 57 | +    *     etc.)  | 
 | 58 | +    *   - The handler URL's origin does not match the origin of the page calling this API.  | 
 | 59 | +    *   - The browser requires that this function is called from a secure context.  | 
 | 60 | +    *   - The browser requires that the handler's URL be over HTTPS.  | 
 | 61 | +    *  | 
 | 62 | +    * @throws SyntaxError  | 
 | 63 | +    *   DOMException: The %s placeholder is missing from the handler URL  | 
 | 64 | +    */  | 
 | 65 | +  def unregisterProtocolHandler(scheme: String, url: String): Unit = js.native  | 
 | 66 | + | 
 | 67 | +}  | 
0 commit comments