Skip to content

Instantly share code, notes, and snippets.

@ahmetgungor
Last active February 16, 2016 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmetgungor/ab2430697a0f9dd820d6 to your computer and use it in GitHub Desktop.
Save ahmetgungor/ab2430697a0f9dd820d6 to your computer and use it in GitHub Desktop.
Html5 Notification Kullanımı
<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