-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
notifications-with-permission.html
43 lines (36 loc) · 1.22 KB
/
notifications-with-permission.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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function log(message)
{
document.getElementById("result").innerHTML += message + "<br>";
}
function runTests()
{
if (window.testRunner) {
testRunner.grantWebNotificationPermission("file://");
testRunner.dumpAsText();
if (testRunner.dumpNotifications)
testRunner.dumpNotifications();
testRunner.waitUntilDone();
}
if (!window.webkitNotifications) {
log("FAIL: No webkitNotifications interface!");
}
var N = window.webkitNotifications.createHTMLNotification("http://0.0.0.0/my_notification.html");
N.show();
var M = window.webkitNotifications.createNotification("http://0.0.0.0/my_icon.png", "New E-mail", "Meet me tonight at 8!");
M.ondisplay = function() { testRunner.notifyDone(); }
M.show();
}
</script>
</head>
<body>
<p>Sending notifications with permission...</p>
<script type="text/javascript">
runTests();
</script>
<div id="result"></div>
</body>
</html>