public interface CefSchemeRegistrar
限定符和类型 | 方法和说明 |
---|---|
boolean |
addCustomScheme(java.lang.String schemeName,
boolean isStandard,
boolean isLocal,
boolean isDisplayIsolated,
boolean isSecure,
boolean isCorsEnabled,
boolean isCspBypassing)
Register a custom scheme.
注册自定义方案
|
boolean addCustomScheme(java.lang.String schemeName, boolean isStandard, boolean isLocal, boolean isDisplayIsolated, boolean isSecure, boolean isCorsEnabled, boolean isCspBypassing)
[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. 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.
[scheme]://[username]:[password]@[host]:[port]/[url-path]标准方案URL必须具有主机组件,该组件是RFC 1034 [13]的第3.5节和RFC 1123的第2.1节中定义的完全限定的域名。这些URL将被规范化为“scheme:// host / path”。最简单的情况和“scheme:// username:password @ host:port / path”在最明确的情况下。例如,“scheme:host / path”和“scheme:/// host / path”都将被规范化为“scheme:// host / path”。标准方案URL的来源是方案,主机和端口的组合(即,在最明确的情况下,“scheme:// host:port”)。对于非标准方案URL,仅对“scheme:”组件进行解析和规范化。 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,set | is_cors_enabled |为true,并使用CORS“Access-Control-Allow-Origin”标头进一步限制访问。如果| isSecure |确实,该方案将使用与应用于“https”URL的安全规则相同的安全规则。例如,从其他安全方案加载此方案不会触发混合内容警告。如果| isCorsEnabled |是可以发送CORS请求的方案。在| isStandard |的大多数情况下,此值应为true是真的。如果| isCspBypassing |确实,该方案可以绕过内容安全策略(CSP)检查。在| isStandard |的大多数情况下,此值应为false是真的。可以在任何线程上调用此函数。每个唯一的| schemeName |只应调用一次值。如果| schemeName |已注册或如果发生错误,此方法将返回false