How to open a link outside the app in RocketWeb? | RokcetWeb Android

My app is running well but I want to open some page outside of app. How can I open a URL in a mobile browser?

If you want to open the link on the custom tab then follow: https://help.infixsoft.com/how-to-open-external-url-on-custom-tab/

If you want to apply this login for any web view action. Then the URL you want to overwrite just write condition under WebViewClient.

Here when my webview is trying to load google’s “http://www.google.com” URL then it’s open outside of the app. If you want more logic to apply just add one by one. Remember that in this case, you need to set a full URL.

if(url == "http://www.google.com"){
    UtilMethods.browseUrlExternal(mContext, url)
    return true
}

Tips: If you want to open every URL of google outside of the app then follow the below code.

if(url.contains("google.com")){
    UtilMethods.browseUrlExternal(mContext, url)
    return true
}

Tips: If you want without google URLs open outside of the then follow below code.

if(!url.contains("www.google.com")){
    UtilMethods.browseUrlExternal(mContext, url)
    return true
}

Tips: If you want to open outside od all URL which starts with a google domain.

if(url.startsWith("www.google.com")){
    UtilMethods.browseUrlCustomTab(mContext, url)
    return true
}

9 thoughts on “How to open a link outside the app in RocketWeb? | RokcetWeb Android

  1. ProfesorYeow says:

    Hello… I want to have a list of URL for use inside the app and any other go outside the app… how i can do it?
    I implement this code but doesn’t work:

    if(!url.contains(“.domain1.com”)
    || !url.contains(“.domain2.com”)
    || !url.contains(“.domain3.com”)

    ){
    UtilMethods.browseUrlExternal(mContext, url)
    return true
    }

    // NOTE: Put a domain take all possibilities? .domain1.com also take http://www.domain1.com sub.domain1.com etc

    1. ProfesorYeow says:

      Please edit my comment… this is the code (without dot in the domain)

      if( !url.contains(“domain1.com”)
      || !url.contains(“domain2.com”)
      || !url.contains(“domain3.com”)

      ){
      UtilMethods.browseUrlExternal(mContext, url)
      return true
      }

      1. admin says:

        I mention here only put domain name then will support all of the domain links, include sublink. Example my URL: https://help.infixsoft.com/how-to-open-external-url-on-custom-tab/

        Then you need to be added on condition: infixsoft.com

      1. idtechsa says:

        Good thing,
        But there is an important point, please pay attention to it
        Payment gateways like Paypal and others,
        Its important links open inside the app
        For the payment process is not affected

Leave a Reply