Skip to main content
This article describes how to use the MoEngage Web SDK in WebView inside a Mobile App.
  • WebSDK uses browser storage, which is not enabled by default for WebView Applications.
  • For Mobile Apps, we must explicitly enable browser storage by providing javascript permission.

Steps to Enable WebSDK in WebView

To run WebSDK in WebView,
  • Ensure you have correctly integrated Web SDK into your website.
  • Ensure you provide permission to use JavaScript for your Android/iOS app.

For Android Apps

Step 1: Configure Your WebView Within your app, locate the WebView component for which you wish to enable JavaScript. Ensure you have the proper imports:
Step 2: Enable JavaScript and DomStorage Permissions Using the WebSettings class, enable JavaScript:
Step 3: Advanced Settings For more control, you may use additional settings such as:
It is important to consider the security implications of enabling JavaScript. Always validate the URL you load in WebView.

For iOS Apps

Step 1: Import WebKit First, ensure you’ve imported the WebKit framework in your ViewController:
Step 2: Create a WKWebView Create an instance of WKWebView and add it to your view:
Step 3: Enable JavaScript JavaScript is enabled by default on WKWebView, but you can verify or change the settings through the WKPreferences object:

Supported Modules

In WebView, we support the following modules:
  • Data Tracking
  • On-site Messaging
  • Card’s
  • Web Personalization