-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
63 lines (39 loc) · 1.3 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js "></script><!--////jquery-->
//<script src="bridge.js"></script><!--////jsbridge-->
<script src="rem.js"></script><!--//百分比布局-->
</head>
<body>
<button id="clickBut" class="button">判断androidIOS</button>
<button id="jsCallPhone" class="button">jsCallPhone</button>
</body>
<script type="text/javascript">
$(document).ready(function () {
$("#clickBut").click(function () {
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
alert('是否是Android:' + isAndroid);
alert('是否是iOS:' + isiOS);
});
$("#jsCallPhone").click(function () {
TestJavascriptBridge.jsCallPhone("你好 我是JAVASCRIPT")
});
});
//手机调用js
function phoneCallJs(str) {
alert(str.toString());
}
</script>
<style>
.button {
width: 100%;
height: 1rem;
font-size: .5rem;
}
</style>
</html>