Skip to main content

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.

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)
}
}

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.