@grabjs/superapp-sdk
    Preparing search index...

    Class SystemWebViewKitModule

    JSBridge module for opening URLs in the device's system browser.

    Allows MiniApps to redirect users to external content using the native system browser. This code must run on the Grab SuperApp's WebView to function correctly.

    ES Module:

    import { SystemWebViewKitModule } from '@grabjs/superapp-sdk';
    const webViewKit = new SystemWebViewKitModule();

    CDN (UMD):

    <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
    <script>
    const webViewKit = new SuperAppSDK.SystemWebViewKitModule();
    </script>

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Opens a URL in the device's system web browser or web view.

      Parameters

      Returns Promise<RedirectToSystemWebViewResponse>

      Confirmation of whether the redirect to system web view was successful.

      Simple usage

      import { SystemWebViewKitModule, isSuccess, isErrorResponse } from '@grabjs/superapp-sdk';

      // Initialize the system web view kit module
      const webViewKit = new SystemWebViewKitModule();

      // Open a URL in system web view
      const response = await webViewKit.redirectToSystemWebView({
      url: 'https://www.example.com'
      });

      // Handle the response
      if (isSuccess(response)) {
      console.log('Redirect initiated successfully');
      } else if (isErrorResponse(response)) {
      console.error(`Error ${response.status_code}: ${response.error}`);
      } else {
      console.error('Unhandled response');
      }