Last active
February 16, 2016 11:54
-
-
Save ahmetgungor/ab2430697a0f9dd820d6 to your computer and use it in GitHub Desktop.
Html5 Notification Kullanımı
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// tarayıcı türleri ie,chrome,mozilla | |
var notification = window.Notification || window.mozNotification || window.webkitNotification; | |
// Kullanıcı izini | |
if ('undefined' === typeof notification) | |
alert('Web notification not supported'); | |
else | |
notification.requestPermission(function(permission){}); | |
//bildirim | |
function Notify(titleText, bodyText,redirect,imgurl) | |
{ | |
if ('undefined' === typeof notification) | |
return false; // | |
var noty = new notification( | |
titleText, { | |
body: bodyText, | |
dir: 'auto', // bildirim pozisyonu ltr, rtl | |
tag: 'notificationPopup', | |
icon: imgurl | |
} | |
); | |
noty.onclick = function () { | |
console.log('Click'); | |
window.location=redirect; | |
}; | |
noty.onerror = function () { | |
console.log('Error'); | |
}; | |
noty.onshow = function () { | |
console.log('Show'); | |
}; | |
noty.onclose = function () { | |
console.log('Close'); | |
}; | |
return true; | |
} | |
Notify('deneme','Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem, magni nihil! Maxime illo, tempore ratione, eaque ex quo at repellat dolorem culpa mollitia aliquam reiciendis, perspiciatis illum nostrum et voluptate?','https://supersigortam.com/_theme/images/call_center.png','https://supersigortam.com/_theme/images/call_center.png'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment