sihorton/appjs-deskshell

HTML5 notifications

imperator-maximus opened this issue · 4 comments

Hi,

I tried to run HTML 5 notifications in Deskshell in a html file:
my JS code:
if (window.webkitNotifications) {
console.log("Notifications are supported!");
}
else {
console.log("Notifications are not supported for this Browser/OS version yet.");
}
if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED
var notification =
webkitNotifications.createNotification('http://i.stack.imgur.com/dmHl0.png','TITLE','BODY 123');
notification.show();

} else {
console.log("request permission");
window.webkitNotifications.requestPermission();
}

I am getting output:
"Notifications are supported!"
"request permission" But there is no permission request. I also would say that this is not needed in that environment.
I also tried http://blog.chromium.org/2013/05/rich-notifications-in-chrome.html?m=1
but chrome.notifications object is empty.

This works for me (on windows port). If for example you create an html page and add a link to: https://developer.mozilla.org/en-US/docs/Web/API/notification then run your deskshell application, click on the link and then scroll down to the bottom of the page and under "See the live result" click on "Notify me!". It then pops up an OS notification message.

ah that is cool. Thanks for pointing out the new syntax! Also works on Mac - thanks for fast reply.

Great, perhaps we should add it as a demo!

I have added a very basic demo to the showcase repository: https://github.com/sihorton/deskshell-showcase/tree/master/html5_notifications

Feel free to improve it if you want!