-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.html
90 lines (75 loc) · 2.18 KB
/
app.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<head>
<!-- Please make sure user-scalable=no is only used carefully -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<style>
body {
font: -apple-system-body;
padding: 16px;
margin: 0;
}
footer {
font: -apple-system-footnote;
}
label {
display: block;
margin-bottom: 1em;
}
input {
display: block;
width: 100%;
padding: .5em;
border: 1px solid #e0e0e0;
border-radius: 4px;
font-size: inherit;
}
</style>
</head>
<body>
<h1>Demo</h1>
<form id="form" action="">
<label>Name:
<input type="text" id="name" name="name">
</label>
<label>Home Tel:
<input type="tel" id="tel" name="tel">
</label>
<label>Mobile Tel:
<input type="tel" id="mobile-tel" name="mobile-tel">
</label>
<label>Income
<input type="number" id="income" pattern="[0-9]*" name="income">
</label>
<label>
<input type="button" id="send-back" value="Send back to iOS">
</label>
</form>
<p>Debug: <span id="preferredContentSizeCategory"></span></p>
<footer>Footer placeholder.</footer>
<script src="https://code.jquery.com/jquery.min.js"></script>
<script>
// document.write(window.navigator.userAgent);
let userAgent = window.navigator.userAgent;
if (userAgent.indexOf("Demo App iOS") >= 0) {
$("h1").hide();
}
function fillInForm(name, tel, mobileTel) {
$("#name").val(name);
$("#tel").val(tel);
$("#mobile-tel").val(mobileTel);
return "Form filled by JavaScript."
}
function setAccessibilityFontSize(size) {
$("#preferredContentSizeCategory").text(size);
}
$("#send-back").on('click', function(){
var data = {
'name': $("#name").val(),
'tel': $("#tel").val(),
'mobileTel': $("#mobile-tel").val(),
'income': $("#income").val()
}
// The "notification" has to match the name of userContentController in Swift.
window.webkit.messageHandlers.notification.postMessage({ hello: "world from web/JS", data: data} );
});
</script>
</body>