All Products
Search
Document Center

Mobile Platform as a Service:Start HTML5 application

Last Updated:Feb 23, 2021

You can call this operation to open an HTML5 application. This method has been deprecated. The startApp API is recommended.

startH5App API usage instruction

  1. AlipayJSBridge.call('startH5App', {
  2. appId: '20000067',
  3. url: '/www/index.html',
  4. });

Code sample

  1. <h1>Click the button to view the effect.</h1>
  2. <a href="javascript:void(0)" class="btn dream">Open My savings.</a>
  3. <script>
  4. function ready(callback) {
  5. // Call JS Bridge if it has been injected.
  6. if (window.AlipayJSBridge) {
  7. callback && callback();
  8. } else {
  9. // Listen to the injection event if it has not been injected.
  10. document.addEventListener('AlipayJSBridgeReady', callback, false);
  11. }
  12. }
  13. ready(function(){
  14. document.querySelector('.dream').addEventListener('click', function() {
  15. AlipayJSBridge.call('startH5App', {
  16. appId: '20000981',
  17. url: '/www/dream-create.html',
  18. // Input startup parameters.
  19. });
  20. });
  21. });
  22. </script>

API

  1. AlipayJSBridge.call('startH5App', {
  2. appId, url, ...param
  3. })

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