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:
- Your
WKWebView
instance - Your
ConsentManager
instance - Your
ConsentUiBuilder
instance (Optional) - A boolean to show the web widget (Optional)
- Swift
- Objective-C
// 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)
)
// Init the WKWebView before passing it to the wrapper
ConsentWebViewWrapper *webViewWrapper = [[ConsentWebViewWrapper alloc]
initWithWebView: 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)
];