shouldUseNewSchemeHandler method
This method controls whether to use the new scheme handler for URLs.
Note:
- The shouldUseNewSchemeHandler method takes effect only when the schemeTaskHandlerEnabled method returns
YES. - This method is used for H5 containers only, and it has no effect for mini programs.
Method signature
copy
func shouldUseNewSchemeHandler(for url: URL) -> BoolParameters
Parameter | Data type | Required | Description |
url | String | Yes | Indicates the URL of the H5 page to open. Default value: |
Return value
Parameter | Data type | Required | Description |
N/A | BOOL | Yes | Return the result of whether to use the new scheme handler for URLs:
|
Sample
copy
class DemoSchemeTaskHandlerDelegate: NSObject, GRVSchemeTaskHandlerDelegate {
func shouldUseNewSchemeHandler(for url: URL) -> Bool {
if let host = url.host, host.contains("xxx") {
return true
}
return false
}
}