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

    Class SystemWebViewKitModule

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

    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@x.y.z/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>

      This method can return the following status_code values:

      • 200 (OK): Redirect initiated successfully.
      • 400 (Bad Request): Invalid request parameters.
      • 424 (Failed Dependency): Dependency error occurred while processing the request.
      • 500 (Internal Server Error): An unexpected error occurred.
      • 501 (Not Implemented): Requires Grab app environment.
      import { SystemWebViewKitModule, isSuccess, isError } 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 (isError(response)) {
      console.error(`Error ${response.status_code}: ${response.error}`);
      } else {
      console.error('Unhandled response');
      }