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
|
<html>
<body>
<script>
var actions = [
{
permissions: ["video-capture"],
action: function() {
// invoke video-capture permission prompt
navigator.mozGetUserMedia({video: true}, function () {}, function () {});
}
},
{
permissions: ["audio-capture", "video-capture"],
action: function() {
// invoke audio-capture + video-capture permission prompt
navigator.mozGetUserMedia({audio: true, video: true}, function () {}, function () {});
}
},
{
permissions: ["audio-capture"],
action: function() {
// invoke audio-capture permission prompt
navigator.mozGetUserMedia({audio: true}, function () {}, function () {});
}
},
{
permissions: ["geolocation"],
action: function() {
// invoke geolocation permission prompt
navigator.geolocation.getCurrentPosition(function (pos) {});
}
},
{
permissions: ["desktop-notification"],
action: function() {
// invoke desktop-notification prompt
Notification.requestPermission(function (perm) {});
}
},
];
// The requested permissions are specified in query string.
var permissions = JSON.parse(decodeURIComponent(window.location.search.substring(1)));
for (var i = 0; i < actions.length; i++) {
if(permissions.length === actions[i].permissions.length &&
permissions.every(function(permission) {
return actions[i].permissions.indexOf(permission) >= 0;
})) {
actions[i].action();
break;
}
}
</script>
</body>
</html>
|