GRVSchemeTaskHandlerDelegate(Optional)
When opening web-view pages, the web_viewSchemeTaskHandlerEnabled method of the GRVSchemeTaskHandlerDelegate can control whether to use the mini program internal configuration rather than the defaut settings (WKWebViewConfiguration).
Procedures
Step 1. Implement the GRVSchemeTaskHandlerDelegate delegate
Implement the GRVSchemeTaskHandlerDelegate delegate and write code in the required methods according to your business logic.
Code sample as follows:
class DemoSchemeTaskHandlerDelegate: NSObject, GRVSchemeTaskHandlerDelegate {
func web_viewSchemeTaskHandlerEnabled(forURL url: String) -> Bool {
var enable = true
if let u = URL(string: url), let host = u.host() {
let blackList = [
"url"
]
return !blackList.contains(host)
}
return true
}
}Step 2. Configure the GRVSchemeTaskHandlerDelegate delegate
Configure the GRVExtensionDelegate interface to register the GRVSchemeTaskHandlerDelegate delegate after initializing the SDK.
Delegates
GRVSchemeTaskHandlerDelegate delegate
Based on the definition above, this interface provides the following method:
Method | Description |
This method is used for |
web_viewSchemeTaskHandlerEnabled method
Method signature
This function determines whether the web view scheme task handler is enabled.
func web_viewSchemeTaskHandlerEnabled(forURL url: String) -> BoolParameters
Parameter | Data type | Required | Description |
url | String | Yes | Indicates the URL of the Default value: |
Return value
Parameter | Data type | Required | Description |
N/A | BOOL | Yes | Return the result of whether mini program's internal configuration is used for web view:
|