大网数据广告活动
Web 标准与前端开发

prefer_related_applications

· 52CE 我爱测

The `prefer_related_applications` manifest member is used to provide a hint to browsers whether to prefer installing native applications specified in the `related_applications` manifest member over your web application.

The prefer_related_applications manifest member is used to provide a hint to browsers whether to prefer installing native applications specified in the related_applications manifest member over your web application.

Syntax

/* Boolean values */
"prefer_related_applications": true
"prefer_related_applications": false

Values

  • prefer_related_applications
    • : A boolean value:
      • If set to true, browsers may prompt users to install one of the applications listed in related_applications instead of your web app.
      • If set to false or omitted, browsers will prefer to install your web app over related native applications.

        [!NOTE] For Chromium-based browsers, prefer_related_applications should be set to false or omitted to make your web app installable.

Examples

Specifying preference for installing your web app

Consider a scenario where you have both a web app and native apps for your product available on Google Play Store and Windows Store. If you want to offer related native apps as options but prefer users to install your web app, you can set it up in your manifest file as shown below. Browsers will promote your web app for installation. The native apps will still be available as alternatives.

{
  "prefer_related_applications": false,
  "related_applications": [
    {
      "platform": "play",
      "id": "com.example.hiking-app"
    },
    {
      "platform": "windows",
      "url": "https://apps.microsoft.com/detail/9nqx6sv74srz"
    }
  ]
}

Specifying preference for installing the related native app

To encourage users to install your native Android hiking app from Google Play Store in preference to the web app, you can configure your web app's manifest file as shown below.

{
  "prefer_related_applications": true,
  "related_applications": [
    {
      "platform": "play",
      "id": "com.example.hiking-app"
    }
  ]
}

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。