The new TAB links want to open inside of the app not in popup

After buying RocketWeb from codecanyon, everything is working fine. But the new TAB links are opens in a popup view but I want to open it inside of app.

Solution:

First, remove this line to stop the popup.

Then add/update this link of code to open the link in webview.

var popupUrl: String? = null
if (view?.hitTestResult?.type === WebView.HitTestResult.SRC_ANCHOR_TYPE
    || view?.hitTestResult?.type === WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE
) {
    popupUrl = view.hitTestResult.extra
    if (popupUrl?.compareTo("about:blank") != 0){
        mBinding.webView.loadUrl(popupUrl.toString())
    }
}
UtilMethods.printLog(TAG, "Popup URL: $popupUrl")

Extra:

In case if you want to open any link external or internal browser then follow this:

Leave a Reply