码迷,mamicode.com
首页 > Windows程序 > 详细

1、内嵌web ,web内用api对象

时间:2020-03-04 09:58:52      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:nbsp   for   scale   meta   url   detection   sea   art   phone   

1、

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>云API</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css"/>
    <link rel="stylesheet" type="text/css" href="./css/style.css"/>
</head>
<body>
  <header>
  </header>
</body>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript">
    apiready = function () {
      var closeAPP = {
          count: 0,
          timer: null,
          time: 1500
      }
      api.addEventListener({
            name: keyback
          }, function(ret, err) {
          closeAPP.count++;
          if(closeAPP.count >= 2){
              api.closeWidget({
                  id: A6028342539653,
                  silent: true,
                  })
          }
          else{
                /*api.toast({
                    msg: ‘再按一次退出应用‘,
                    duration: closeAPP.time,
                    location: ‘bottom‘
                });*/
                browser.historyBack(
                    function(ret, err) {
                        if (!ret.status) {
                            //api.closeWin();
                            //直接退出,不用closeWin() 这种强硬的方式
                        }
                    }
                );
            }
            clearTimeout(closeAPP.timer);
            closeAPP.timer = setTimeout(function(){
                    closeAPP.count = 0;
            },closeAPP.time)
        });
        //双击退出APP
        $api.fixStatusBar( $api.dom(header) );
        api.setStatusBarStyle({
            style: dark,
            color: #6ab494
        });
        api.openWin({
            name: page1,
            url: http://suyijie.weiyouqq.com,
            pageParam: {
                name: test
            }
        });
        /*
        <!DOCTYPE HTML>
        <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title></title>
        </head>
        <body>
        <script>
            alert("我是正常的运行~!");
            apiready = function (){
                //alert("我是内部运行~!");
            }
        </script>
        </body>
        </html>
        */
    }
  </script>
</html>

 

1、内嵌web ,web内用api对象

标签:nbsp   for   scale   meta   url   detection   sea   art   phone   

原文地址:https://www.cnblogs.com/fger/p/12407206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!