Skip to main content
Version: 23.8.0

Page.setBypassCSP()方法

¥Page.setBypassCSP() method

切换绕过页面的内容安全策略。

¥Toggles bypassing page's Content-Security-Policy.

签名

¥Signature

class Page {
abstract setBypassCSP(enabled: boolean): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

enabled

boolean

设置绕过页面的内容安全策略。

Returns:

Promise<void>

备注

¥Remarks

注意:CSP 绕过发生在 CSP 初始化时而不是评估时。通常,这意味着应在导航到域之前调用 page.setBypassCSP

¥NOTE: CSP bypassing happens at the moment of CSP initialization rather than evaluation. Usually, this means that page.setBypassCSP should be called before navigating to the domain.