You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Windows 11系统Chrome浏览器中navigator.getInstalledRelatedApps()返回空数组问题排查

Fixing navigator.getInstalledRelatedApps() Returning Empty Array

Let's break down your issue, answer your key question, and confirm the solution you discovered:

Short answer: No, not for web-only apps. That file exists primarily to link native mobile apps (like Android APKs) to web apps for cross-app permissions or deep linking. For standalone web apps, the critical configuration that enables this API is in your Web App Manifest's related_applications field.

Why your API call was returning an empty array

The root problem was a misconfiguration in your Manifest's related_applications section. You originally set the url field to point directly to your Manifest file ("/_new/manifest.json"), but the web app spec requires this value to be the root path of your web app (like "/") instead of the specific Manifest URL.

Original (broken) configuration:

"related_applications": [ { 
  "id": "https://www.swisswebcams.ch/", 
  "platform": "webapp", 
  "url": "/_new/manifest.json" 
} ]

Fixed configuration:

"related_applications": [ { 
  "id": "https://www.swisswebcams.ch/", 
  "platform": "webapp", 
  "url": "/" 
} ]

How to verify the fix

  1. Confirm your web app is properly installed via Chrome (check your Windows 11 Start Menu or Chrome's "Installed apps" list)
  2. Run this code in the browser console to validate:
if('getInstalledRelatedApps' in navigator) {
  navigator.getInstalledRelatedApps().then(apps => console.warn(apps));
}

After updating the Manifest, you'll see your installed web app appear in the returned array.

Quick checks to avoid future issues

  • Your Chrome version (146.0.7680.178) fully supports the getInstalledRelatedApps() API
  • Your site runs over HTTPS (a hard requirement for this API to function)
  • Ensure the id in your Manifest matches the id in related_applications (your setup here is valid, since "/" resolves to the full site URL)

内容的提问来源于stack exchange,提问作者Simon Ferndriger

火山引擎 最新活动