-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpush.html
More file actions
31 lines (29 loc) · 968 Bytes
/
push.html
File metadata and controls
31 lines (29 loc) · 968 Bytes
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 lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Push.js Example</title>
<!-- Inclua o Push.js via CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/push.js/1.0.5/push.js"></script>
</head>
<body>
<h1>Push.js Example</h1>
<button onclick="sendNotification()">Enviar Notificação</button>
<script>
// Função para enviar uma notificação
function sendNotification() {
Push.create("Título da Notificação", {
body: "Corpo da Notificação",
icon: "caminho/para/icone.png", // URL do ícone da notificação
timeout: 4000, // Tempo em milissegundos antes da notificação desaparecer automaticamente
onClick: function () {
// Função a ser executada quando a notificação for clicada
window.focus();
this.close();
}
});
}
</script>
</body>
</html>