This feature requires version 2.17.8 or later of the Notifly JS SDK,
@notifly-tech/notifly-js-sdk.Overview
When you set a web popup to Open in external browser in the Notifly console, the JS SDK opens the link withtarget="_blank". In standard mobile browsers such as Chrome and Safari, no additional configuration is required.
A WebView in a native app needs native handling to open these links outside the WebView. Without that handling, the link can open in the same WebView or do nothing.
If your app displays Notifly web popups in a WebView, add the native configuration for your platform below.
If you use only the Notifly Android SDK or iOS SDK to display in-app popups, the SDK already handles links. You do not need this additional configuration.
Configure your platform
- Android
- iOS
Android WebView does not open
target="_blank" links in an external browser automatically. Apply both steps below.Step 1. Enable multiple windows
Configure the WebView to handle requests to open a new window.- Kotlin
- Java
Step 2. Forward requests to open a new window
After you enable multiple windows, tapping atarget="_blank" link calls WebChromeClient.onCreateWindow(). In this method, capture the URL and pass it to the system URL handler. For web links, this normally opens the device’s default browser.- Kotlin
- Java
These examples use the
shouldOverrideUrlLoading(WebView, WebResourceRequest) overload, which requires Android 7.0 (API level 24) or later. If your app already uses a WebChromeClient, add onCreateWindow() to that class.How it works
With this configuration, links open outside the WebView as follows.- A user taps a button in a Notifly web popup. The JS SDK opens the link with
target="_blank". - The WebView delegates the request to open a new window to native code through
onCreateWindowon Android orcreateWebViewWithon iOS. - Native code extracts the URL and passes it to the system URL handler, which normally opens web links in the device’s default browser, such as Chrome or Safari.
Notes
- This configuration applies only when the message’s link opening mode is Open in external browser in the Notifly console. With the default mode, Open in current window, links open inside the WebView regardless of this configuration.
