Display desktop notifications | Javascript

function notifyMe(title, options) { // Check if the browser supports notifications if (!("Notification" in window)) { console.log("This browser does not support desktop notification"); } // Check whether notification permissions have alredy been granted else if (Notification.permission === "granted") { // If it's okay let's create a notification var notification = new Notification(title, options); } // Otherwise, we need to ask the user for permission else if (Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { // If the user accepts, let's create a notification if (permission === "granted") { var notification = new Notification(title, options); } }); } } var title = "Codepad Notification"; var options = { body: "Codepad Notification Body", icon: "http://s28.postimg.org/5rzz2yemh/codepad.png" } notifyMe(title, options);
Display desktop notifications. jsFiddle example: https://jsfiddle.net/bjx04e9d/

8 Responses

Thats really cool, gonna be useful in my current project, thanks a lot Cristian!
I'm glad you like it. If you want more stuff about HTML, CSS, Js ask me.
Hehehehe, agora seguindo aqui tmb! Hehehe
<}htt
https://www.cybercitymodel.com/call-girls-dehradun.php
https://www.cybercitymodel.com/call-girls-chandigarh.php
https://www.cybercitymodel.com/call-girls-goa.php
https://www.cybercitymodel.com/call-girls-jaipur.php
https://www.cybercitymodel.com/call-girls-lucknow.php
https://www.cybercitymodel.com/call-girls-mumbai.php
https://www.cybercitymodel.com/rate.php
https://www.cybercitymodel.com/escorts/call-girls-in-sohna-road.php
https://www.cybercitymodel.com/call-girls-hyderabad.php
https://www.cybercitymodel.com/call-girls-bangalore.php
https://www.cybercitymodel.com/call-girls-chennai.php
https://www.cybercitymodel.com/escorts/call-girls-in-dlf-phase-3.php
https://www.cybercitymodel.com/call-girls-faridabad.php
https://www.cybercitymodel.com/call-girls-kolkata.php
https://www.cybercitymodel.com/call-girls-noida.php
https://www.cybercitymodel.com/call-girls-ahmedabad.php
https://www.cybercitymodel.com/escorts/call-girls-in-manesar.php
https://www.cybercitymodel.com/escorts/dwarka-escort.php
https://www.cybercitymodel.com/escorts/call-girls-in-rajiv-chowk.php
https://www.cybercitymodel.com/
https://www.cybercitymodel.com/about.php
https://www.cybercitymodel.com/delhi-escorts-service.php
https://www.cybercitymodel.com/call-girls-delhi.php
https://www.cybercitymodel.com/escorts/call-girls-in-hudda-city-centere.php
https://www.cybercitymodel.com/escorts/call-girls-in-gurgaon-south-city.php
https://www.cybercitymodel.com/escorts/call-girls-in-mg-road-gurgaon.php
https://www.cybercitymodel.com/escorts/aerocity-escort.php
https://www.cybercitymodel.com/call-girls-paharganj.php
https://www.cybercitymodel.com/call-girls-mahipalpur.php

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.