H5调用安卓和iOS方法通过js
作者:
笨的很想飞 | 来源:发表于
2022-07-04 13:51 被阅读0次<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>发送咨询单</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- 引入vant-->
</head>
<body>
<div style=" background-color: #f4f4f4;">
<h2 onclick="onCancel()">测试</h2>
</div>
</body>
</html>
<script>
function onCancel() {
console.log(123)
if (window.webkit != undefined) {
<!-- 方法名 -- -(void)back{}>
window.webkit.messageHandlers.back.postMessage('');
} else {
/* eslint-disable */
android.backHome();
}
};
</script>
本文标题:H5调用安卓和iOS方法通过js
本文链接:https://www.haomeiwen.com/subject/bdbygqtx.html
网友评论