WebView continuity
If your app opens web pages that also run the OptSens web banner, share the app's decision with the web view so the banner does not ask again. The SDK pre-seeds that decision into the page before it loads, in the form the web script already reads, so the web banner treats it as an existing choice, stays quiet, and its vendors get the same TC/AC strings.
- Android
- iOS
Inject the consent from your WebViewClient, before the page loads:
webView.webViewClient = object : WebViewClient() {
override fun onPageStarted(view: WebView, url: String?, favicon: Bitmap?) {
OptSensWebBridge.inject(view)
}
}
Install the consent into your web view configuration before you create the
WKWebView:
let config = WKWebViewConfiguration()
OptSensWebBridge.installConsent(into: config)
let webView = WKWebView(frame: .zero, configuration: config)
Call OptSensWebBridge.refreshConsent(in: webView) after the visitor changes
their choice. WebView continuity is iOS-only; tvOS has no web view.
Until a decision exists, the bridge has nothing to share. Before the visitor's first choice it injects nothing, and the web banner collects consent as usual.