Skip to main content
Version: 24.38.0

Page.setBypassCSP()方法

🌐 Page.setBypassCSP() method

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

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

语法

🌐 Signature

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

参数

🌐 Parameters

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

enabled

boolean

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

🌐 sets bypassing of page's Content-Security-Policy.

返回:

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.