Opens a URL in the device's system web browser or web view.
The URL to open in the system web view.
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');
}
JSBridge module for opening URLs in the device's system browser.
Remarks
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.
Example
ES Module:
Example
CDN (UMD):