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