navigator.installThis directory contains demos that showcase the use of navigator.install, an API under development by the Microsoft Edge team to allow web contents to declaratively install other web apps.
install()Requirements:
id field defined./* Current Document: 0-param Signature*/
const installApp = async () => {
if (!navigator.install) return; // api not supported
try {
await navigator.install();
} catch(err) {
switch(err.name){
case 'AbortError':
/* Operation was aborted*/
break;
}
}
};
install(<install_url>) Requirements:
install_url must link to a manifest file.id field defined./*Background Document: 1-param Signature*/
const installApp = async (install_url) => {
if (!navigator.install) return; // api not supported
try {
await navigator.install(install_url);
} catch(err) {
switch(err.name){
case 'AbortError':
/* Operation was aborted*/
break;
case 'DataError':
/*issue with manifest file or id*/
break;
}
}
};
install(<install_url>, <manifest_id>) Requirements:
install_url must link to a manifest file.manifest_id must match the computed id after parsing the manifest./*Background Document: 2-param Signature*/
const installApp = async (install_url, manifest_id) => {
if (!navigator.install) return; // api not supported
try {
await navigator.install(install_url, manifest_id);
} catch(err) {
switch(err.name){
case 'AbortError':
/* Operation was aborted*/
break;
case 'DataError':
/*issue with manifest file or id*/
break;
}
}
};
The Web Install API is currently available as an Origin Trial 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.
To participate, you’ll need to:
<meta> tag or an HTTP header.<!-- Example of adding the token via a meta tag -->
<meta http-equiv="origin-trial" content="YOUR_TOKEN_HERE">
See Origin Trials Guide for Web Developers to learn more about Origin Trials.
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:
Log an issue here: Web Install Feedback Link
We look forward to hearing from you!