Skip to main content

Browser.installPWA() 方法

🌐 Browser.installPWA() method

安装一个渐进式网页应用(PWA)并返回它的清单ID。

🌐 Installs a Progressive Web App (PWA) and returns its manifest id.

语法​

🌐 Signature

class Browser {
abstract installPWA(options: InstallPWAOptions): Promise<string>;
}

参数​

🌐 Parameters

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

options

安装PWA选项

返回:

Promise<string>

附注​

🌐 Remarks

只有在通过管道连接连接到浏览器时才可用。在 puppeteer.launch 中设置 pipe: true;启动选项默认为 false。底层的 PWA CDP 域不会通过 WebSocket 连接暴露。

🌐 Only available when connected to the browser over a pipe connection. Set pipe: true in puppeteer.launch; the launch option defaults to false. The underlying PWA CDP domain is not exposed over a WebSocket connection.

返回的 manifest id 与 InstallPWAOptions.manifestId 对应,因此可以直接传递给 Browser.launchPWA()、Browser.getPWAState() 或 Browser.uninstallPWA()。

🌐 The returned manifest id echoes InstallPWAOptions.manifestId, so it can be passed directly to Browser.launchPWA(), Browser.getPWAState(), or Browser.uninstallPWA().