html 页面推送消息给ios


<html>
<header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">

var s = {
    "a":1,
    "b":2
}

function secondClick() {
    window.webkit.messageHandlers.aaa.postMessage({body: ''});
}

function alertClick(message){
    window.webkit.messageHandlers.alert.postMessage({body: message});

}

function changeNav(message){
    window.webkit.messageHandlers.changeNav.postMessage({body:message});
}

function showAlert(message){
    window.webkit.messageHandlers.log.postMessage({body: message});
}
function closeWeb(){
    window.webkit.messageHandlers.closeWeb.postMessage({body: 'call js alert in js'});
}


</script>
</header>

<body>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="secondClick()">加载原生控件</button>
</body>


<body>
<br/>
<br/>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="alertClick('123213123')">原生弹窗</button>
</body>

<body>
<br/>
<br/>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="showAlert(1232132)">log日志</button>
</body>

<body>
<br/>
<br/>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="closeWeb()">关闭web</button>
</body>

<body>
<br/>
<br/>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="changeNav('#359DF5&jstitle')">改变导航条</button>
</body>

<body>
<br/>
<br/>
<button type="button" style="width:200;height:80;font-Size:30px"  onclick="fun(s)">传递字典</button>
</body>


</html>


上一篇 下一篇

评论



分享

热门文章

最新加入

最新评论

ss就这样吧: 还是用原声的写吧,这样就不会出现兼容性的问题了 。 查看原文 05月25日 15:55
指尖: 数据库主从配置 查看原文 03月03日 11:26




kefu
0.0514s