-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
31 lines (27 loc) · 1.08 KB
/
index.html
File metadata and controls
31 lines (27 loc) · 1.08 KB
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
<!doctype html>
<html>
<head>
<title>HTTPS to SMS</title>
</head>
<body>
<script>
// Based on https://stackoverflow.com/a/901144/1652620
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
var tel = getParameterByName('tel');
var body = getParameterByName('body');
// Based on https://stackoverflow.com/a/4745622/1652620
if (tel != "" && tel != null) {
window.location = "sms://+" + tel + ";?&body=" + body;
}
</script>
</body>
</html>