Skip to main content
Version: 22.15.0

BrowserContext.isIncognito() 方法

¥BrowserContext.isIncognito() method

警告:此 API 现已过时。

¥Warning: This API is now obsolete.

在 Chrome 中,如果通过参数配置,默认浏览器上下文 也可以是 "incognito",在这种情况下,此 getter 返回错误结果(请参阅 https://github.com/puppeteer/puppeteer/issues/8836)。此外,术语 "incognito" 不适用于其他浏览器。要迁移,请检查 默认浏览器上下文:在 Chrome 中,所有非默认上下文都是隐身的,如果你在启动浏览器时提供 --incognito 参数,则默认上下文可能会隐身。

¥In Chrome, the default browser context can also be "incognito" if configured via the arguments and in such cases this getter returns wrong results (see https://github.com/puppeteer/puppeteer/issues/8836). Also, the term "incognito" is not applicable to other browsers. To migrate, check the default browser context instead: in Chrome all non-default contexts are incognito, and the default context might be incognito if you provide the --incognito argument when launching the browser.

这个 浏览器上下文 是否隐姓埋名。

¥Whether this browser context is incognito.

在 Chrome 中,默认浏览器上下文 是唯一的非隐身浏览器上下文。

¥In Chrome, the default browser context is the only non-incognito browser context.

签名

¥Signature

class BrowserContext {
abstract isIncognito(): boolean;
}

Returns:

boolean