All Products
Search
Document Center

Mobile Platform as a Service:Load failure problem occurs when opening URL in HTML5 container

Last Updated:Nov 17, 2023

Problem description

Redirection happens when opening a URL in an app, and then a load failure message appears.

Troubleshooting

The possible cause of the problem is that the redirect app of third-party Scheme does not exist on the mobile phone, so that the error message ERR_UNKNOWN_URL_SCHEME appears when opening the URL in the app. The troubleshooting procedure is as follows:

  1. Filter logs on the Android Studio console by keyword onReceived, and check if ERR_UNKNOWN_URL_SCHEME exists.

  2. If ERR_UNKNOWN_URL_SCHEME does not exist, skip to Submit a ticket. If ERR_UNKNOWN_URL_SCHEME exists, follow the steps below to implement public interface H5SchemeInterceptProvider, and handle Scheme requests from web side in handlerOnScheme.

    1. In the implementation class of H5SchemeInterceptProvider, create a handlerOnScheme class to handle Scheme requests from web side.

      public class H5SchemeInterceptProviderImpl implements H5SchemeInterceptProvider {
      @Override
      //Handle the redirect of Scheme in the following method
      public boolean handlerOnScheme(String s, H5Page h5Page) {
      //true means to block the request from Scheme, and false indicates not to block
       return true;
      }
      }
    2. Set Provider after mPaaS initialization completes.

      MP.init(this,
              MPInitParam.obtain().setCallback(new MPInitParam.MPCallback() {
                  @Override
                  public void onInit() {
                     // This callback indicates that mPaaS has been initialized, and mPaaS related calls can be made in this callback.      
                      H5Utils.setProvider(H5SchemeInterceptProvider.class.getName(), new H5SchemeInterceptProviderImpl());     
                  }
              })
      );

      For more details, see Initialize mPaaS.

Ticket for assistance

If the problem still exists, prepare a Demo project reproducing the issue and contact mPaaS after-sales support through Alibaba Cloud Ticket System.