public interface CefSchemeRegistrar
限定符和类型 | 方法和说明 |
---|---|
boolean |
addCustomScheme(java.lang.String schemeName, boolean isStandard, boolean isLocal, boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, boolean isCspBypassing, boolean isFetchEnabled)
Register a custom scheme.
(注册自定义方案。)
|
boolean addCustomScheme(java.lang.String schemeName, boolean isStandard, boolean isLocal, boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, boolean isCspBypassing, boolean isFetchEnabled)
[scheme]://[username]:[password]@[host]:[port]/[url-path]Standard scheme URLs must have a host component that is a fully qualified domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of RFC 1123. These URLs will be canonicalized to "scheme://host/path" in the simplest case and "scheme://username:password@host:port/path" in the most explicit case. For example, "scheme:host/path" and "scheme:///host/path" will both be canonicalized to "scheme://host/path". The origin of a standard scheme URL is the combination of scheme, host and port (i.e., "scheme://host:port" in the most explicit case). For non-standard scheme URLs only the "scheme:" component is parsed and canonicalized. The remainder of the URL will be passed to the handler as-is. For example, "scheme:///some%20text" will remain the same. Non-standard scheme URLs cannot be used as a target for form submission. If |isLocal| is true the scheme will be treated with the same security rules as those applied to "file" URLs. Normal pages cannot link to or access local URLs. Also, by default, local URLs can only perform XMLHttpRequest calls to the same URL (origin + path) that originated the request. To allow XMLHttpRequest calls from a local URL to other URLs with the same origin set the CefSettings.file_access_from_file_urls_allowed value to true. To allow XMLHttpRequest calls from a local URL to all origins set the CefSettings.universal_access_from_file_urls_allowed value to true. If |isDisplayIsolated| is true the scheme can only be displayed from other content hosted with the same scheme. For example, pages in other origins cannot create iframes or hyperlinks to URLs with the scheme. For schemes that must be accessible from other schemes set this value to false, set |is_cors_enabled| to true, and use CORS "Access-Control-Allow-Origin" headers to further restrict access. If |isSecure| is true the scheme will be treated with the same security rules as those applied to "https" URLs. For example, loading this scheme from other secure schemes will not trigger mixed content warnings. If |isCorsEnabled| is true the scheme that can be sent CORS requests. This value should be true in most cases where |isStandard| is true. If |isCspBypassing| is true the scheme can bypass Content-Security-Policy (CSP) checks. This value should be false in most cases where |isStandard| is true. If |is_fetch_enabled| is true the scheme can perform Fetch API requests. This function may be called on any thread. It should only be called once per unique |schemeName| value. If |schemeName| is already registered or if an error occurs this method will return false. (注册自定义方案。内置的HTTP,HTTPS,FILE,FTP,ABOUT和DATA方案不应调用此方法。如果|是标准|确实,该方案将被视为标准方案。标准方案必须遵循http://www.ietf.org/rfc/rfc1738.txt上可用的通用Internet方案语法RFC 1738第3.1节中定义的URL规范化和解析规则。特别是,标准方案URL的语法必须为形式: [方案]:// [用户名]:[密码] @ [主机]:[端口] / [URL路径] 标准方案URL必须具有一个主机组件,该主机组件是RFC 1034 [13]的3.5节和RFC 1123的2.1节中定义的完全限定域名。这些URL在规范中将被规范化为“ scheme:// host / path”。最简单的情况,最明确的情况是“方案://用户名:密码@主机:端口/路径”。例如,“ scheme:host / path”和“ scheme:/// host / path”都将被规范化为“ scheme:// host / path”。标准方案URL的来源是方案,主机和端口的组合(在最明显的情况下,即“ scheme:// host:port”)。对于非标准方案URL,仅会解析和规范化“方案:”组件。 URL的其余部分将照原样传递给处理程序。例如,“ scheme:/// some%20text”将保持不变。非标准方案URL不能用作表单提交的目标。如果| isLocal |确实,该方案将采用与应用于“文件” URL的安全规则相同的安全规则。普通页面无法链接或访问本地URL。另外,默认情况下,本地URL只能对发起请求的同一URL(起源+路径)执行XMLHttpRequest调用。要允许从本地URL到源相同的其他URL的XMLHttpRequest调用,请将CefSettings.file_access_from_file_urls_allowed值设置为true。要允许从本地URL到所有源的XMLHttpRequest调用,请将CefSettings.universal_access_from_file_urls_allowed值设置为true。如果| isDisplayIsolated |是的,该方案只能从使用同一方案托管的其他内容中显示。例如,其他来源的网页无法使用该方案创建iframe或指向URL的超链接。对于必须可从其他方案访问的方案,将此值设置为false,请设置| is_cors_enabled |。设为true,然后使用CORS“ Access-Control-Allow-Origin”标头进一步限制访问。如果| isSecure |确实,该方案将采用与应用于“ https” URL的安全规则相同的安全规则。例如,从其他安全方案加载此方案将不会触发混合内容警告。如果| isCorsEnabled |确实可以发送CORS请求的方案。 | isStandard |的大多数情况下,此值应为true是真的。如果| isCspBypassing |确实,该方案可以绕过Content-Security-Policy(CSP)检查。在| isStandard |的大多数情况下,该值应该为false。是真的。如果| is_fetch_enabled |该方案确实可以执行Fetch API请求。可以在任何线程上调用此函数。每个| schemeName |只能调用一次。值。如果| schemeName |已经注册,或者如果发生错误,此方法将返回false。)