2014-01-02 19:43:54 +00:00
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<script>
|
|
|
|
|
2014-02-13 04:16:07 +00:00
|
|
|
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) {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
];
|
2014-01-02 19:43:54 +00:00
|
|
|
|
2014-02-13 04:16:07 +00:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|
2014-01-02 19:43:54 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|