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 ofcustom_config.json
is as follows:[
{
"value": "NO",
"key": "h5_shouldverifyapp"
},
{
"value": "0",
"key": "TSBS"
}
]
- 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 followspublic class H5ExtConfigProviderImpl implements H5ExtConfigProvider {
@Override
public String getConfig(String key) {
if ("h5_shouldverifyapp".equalsIgnoreCase(key)) {
return "YES";
} else if ("TSBS".equalsIgnoreCase(key)) {
return "0";
}
return null;
}
}
// It is recommended that you call at startup, only one instance of H5ExtConfigProvider will be valid globally, subject to the instance in actual settings.
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. |
|
- |
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 |