You can call this operation to open an HTML5 application. This method has been deprecated. The startApp API is recommended.
startH5App API usage instruction
AlipayJSBridge.call('startH5App', {
appId: '20000067',
url: '/www/index.html',
});
Code sample
<h1>Click the button to view the effect.</h1>
<a href="javascript:void(0)" class="btn dream">Open My savings.</a>
<script>
function ready(callback) {
// Call JS Bridge if it has been injected.
if (window.AlipayJSBridge) {
callback && callback();
} else {
// Listen to the injection event if it has not been injected.
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
}
ready(function(){
document.querySelector('.dream').addEventListener('click', function() {
AlipayJSBridge.call('startH5App', {
appId: '20000981',
url: '/www/dream-create.html',
// Input startup parameters.
});
});
});
</script>
API
AlipayJSBridge.call('startH5App', {
appId, url, ...param
})
Input parameters
Name | Type | Description | Required |
---|---|---|---|
appId | String | HTML5 application ID. | Y |
url | String | Parameter for starting an app. This parameter is defined by the specific service app. | N |
param | object | The value is in key-value format and no nesting is supported. | N |