Notification when opening Chrome [closed]

1

Facebook currently launches notifications when opening chrome. How can I do the same thing, ie fire a notification as soon as the user opens the chrome?

    
asked by anonymous 23.11.2016 / 10:23

1 answer

0

Hello, there is an API for browsers to display notifications. These notifications are created via javascript. Below are examples of using the API.

if (("Notification" in window)) {
//Verifica se o navegador tem suporte à notificações

if (Notification.permission === "granted") {
//Verifica se a permissão foi concedida pelo usuário

Notification.requestPermission(function (permission) {
//Requisita permissão para o usuário

var notification = new Notification("Hi there!");
//Envia notificação

To delve into this subject, I left below some links of the documentation:

23.11.2016 / 11:17