You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Use a Chromium-based browser, such as Microsoft Edge or Chrome, and make sure the version is at least 139.0.3402.0 in Edge, or 139.0.7258.0 in Chrome.
15
-
1. In the browser, open a new tab and go to `about:flags`.
16
-
1. Search for "web-app-installation-api" in the search box.
17
-
1. Set the **Web App Installation API** flag to **Enabled**, and then restart the browser.
14
+
**`install()`Requirements**:
15
+
* The current document must link to a manifest file.
16
+
* The manifest file must have an `id` field defined.
18
17
19
-
To share feedback, please [open an issue on the MSEdgeExplainers repository](https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/new?template=web-install-api.md).
18
+
```javascript
19
+
/* Current Document: 0-param Signature*/
20
+
constinstallApp=async () => {
21
+
if (!navigator.install) return; // api not supported
22
+
try {
23
+
awaitnavigator.install();
24
+
} catch(err) {
25
+
switch(err.name){
26
+
case'AbortError':
27
+
/* Operation was aborted*/
28
+
break;
29
+
}
30
+
}
31
+
};
32
+
```
33
+
### Install a background document (any app that's not the current document)
34
+
35
+
**`install(<install_url>)` Requirements:**
36
+
* The document at `install_url` must link to a manifest file.
37
+
* The manifest file must have an `id` field defined.
38
+
39
+
```javascript
40
+
/*Background Document: 1-param Signature*/
41
+
constinstallApp=async (install_url) => {
42
+
if (!navigator.install) return; // api not supported
if (!navigator.install) return; // api not supported
65
+
try {
66
+
awaitnavigator.install(install_url, manifest_id);
67
+
} catch(err) {
68
+
switch(err.name){
69
+
case'AbortError':
70
+
/* Operation was aborted*/
71
+
break;
72
+
case'DataError':
73
+
/*issue with manifest file or id*/
74
+
break;
75
+
}
76
+
}
77
+
};
78
+
```
79
+
80
+
## Try it with Origin Trials!
81
+
82
+
The Web Install API is currently available as an [Origin Trial](https://developer.chrome.com/docs/web-platform/origin-trials/) in Chrome and Microsoft Edge versions 143-148. This allows you to use the feature on your production site and provide valuable feedback to browser vendors before it's finalized.
83
+
84
+
To participate, you'll need to:
85
+
1.**Register for the Origin Trial:**[Web Install registration page link](https://developer.chrome.com/origintrials/#/view_trial/2367204554136616961)
86
+
2.**Add the Origin Trial Token:** Once you have your token, add it to your pages via a `<meta>` tag or an HTTP header.
87
+
88
+
```html
89
+
<!-- Example of adding the token via a meta tag -->
See [Origin Trials Guide for Web Developers](https://github.com/GoogleChrome/OriginTrials/blob/gh-pages/developer-guide.md) to learn more about Origin Trials.
93
+
94
+
## Provide Feedback
95
+
96
+
Your feedback is crucial to the development of this feature. If you encounter any issues, have suggestions, or want to share how you're using the Web Install API, please:
97
+
98
+
**Log an issue here:**[Web Install Feedback Link](https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/new?template=web-install-api.md)
0 commit comments