Skip to main content

Webview Wrapper

The Osano SDK provides a wrapper for the WKWebView class that allows you to send consent to your website that uses the Osano Javascript CMP. This is useful if you have a mobile app that uses a webview to display your website, and your website is also using the Osano Javascript CMP.

Requirements

  • Website using the Osano Javascript CMP
  • Mobile app using the Osano SDK
  • SDK and Website using the same Osano account and CMP configId

Usage

To use the webview wrapper, you need to create an instance of ConsentWebViewWrapper and provide:

  1. Your WKWebView instance
  2. Your ConsentManager instance
  3. Your ConsentUiBuilder instance (Optional)
  4. A boolean to show the web widget (Optional)
// Init the view before passing it to the wrapper
webViewWrapper = ConsentWebViewWrapper(
webView: webView, // Your WKWebView instance
consentManager: consentManager, // Your ConsentManager instance
consentUiBuilder: consentUiBuilder, // Will show the native consentBuilder UI if a user clicks the widget in the WebView (default is nil)
showWebWidget: true // Will show the web widget on the website (default is false)
)