All Products
Search
Document Center

HTML5 container configuration

Last Updated: Mar 04, 2021

HTML5 container has many switch configurations. By modifying the switch configuration, you can change the specific behavior of the container. For example, the offline package signature verification can be turned on or off by the verification configuration.

There are three ways to modify the switch configuration:

  • Add the custom_config.json file to the config folder under assets directory of the portal project or the application’s main project. This method is only available for 10.1.60 and above. The file format of custom_config.json is as follows:
       
    1. [
    2. {
    3. "value": "NO",
    4. "key": "h5_shouldverifyapp"
    5. },
    6. {
    7. "value": "0",
    8. "key": "TSBS"
    9. }
    10. ]
  • Use H5ExtConfigProvider to configure the switch in the codes. This method is only available for versions below 10.1.60. H5ExtConfigProvider instructions for use are as follows
       
    1. public class H5ExtConfigProviderImpl implements H5ExtConfigProvider {
    2. @Override
    3. public String getConfig(String key) {
    4. if ("h5_shouldverifyapp".equalsIgnoreCase(key)) {
    5. return "YES";
    6. } else if ("TSBS".equalsIgnoreCase(key)) {
    7. return "0";
    8. }
    9. return null;
    10. }
    11. }
    12. // It is recommended that you call at startup, only one instance of H5ExtConfigProvider will be valid globally, subject to the instance in actual settings.
    13. H5Utils.setProvider(H5ExtConfigProvider.class.getName(), new H5ExtConfigProviderImpl());
  • Send the switch configuration through the MDS platform, see Switch configuration management.

Container switches list

You can customize whether or not to use the corresponding function by using the switches in the table below.

Switch name Usage Description Default value
h5_shouldverifyapp Turn the signature verification on or off. It is recommended that you turn on it. When the phone is considered to be the root phone, the signature verification will be forced to open. At this time, the switch configuration does not take effect. YES means ON, NO means OFF. YES
TSBS Whether to use the translucent title bar, only for Android. “1” means use, “0” means don’t use. Notice:”1” and “0” should be String type. 1
h5_remote_debug_host Remote server address for real device debugging.
  • If configured, the remote real-device debugging is enabled. The server address for debugging needs to be set in h5_remote_debug_host.
  • If not configured, it will not appear in the code, which means that the remote real-device is not used for debugging, and there is no default value.
-
androidFallbackNetwork Whether to load the fallback resource using the mPaaS network library. YES means load the fallback resource using the mPaaS network library, NO means load the fallback resource using the system network library. YES
mp_h5_push_window_use_activity Whether to force a new activity to start when calling pushWindow. YES means enable, other value means disable. NO
mp_ta_showOptionMenu Whether to display the option menu in the upper right corner of the MINI program.
Note: This configuration is only effective when selecting whether to display the upper right menu during the release of the MINI program.
YES means display, other value means don’t display. NO
mp_ta_showShareMenuItem Whether to display the sharing option in the option menu in the upper right corner of the MINI program. YES means display, other value means don’t display. NO
mp_ta_use_orginal_mini_nagivationbar Whether to use the built-in navigation bar of the MINI program. YES means use, NO means don’t use. YES
h5_CORSWhiteList Domain name whitelist. The offline resources under the domain name can be accessed across domains.
Note: For the resources requested online, a correct cross-domain setting need to be enabled on the resource server.
The content is JSON array, and special characters require escaping. Example: { "value": "[\"oss-cn-hangzhou.aliyuncs.com\"]", "key": "h5_CORSWhiteList" } Null
mp_h5_allow_mix_content Allow MixContent mode. There may be potential security risk to enable this mode, please operate with caution.
Note: This switch is only supported in version 10.1.60.
YES means allow, No means don’t allow. NO