I am trying to implement HTML5 desktop notifications using GWT. Currently this is not supported with the GWT libraries, so I am using native javascript from within GWT(JSNI). I thought this would be fairly straight forward, however I am not having any success. I am using chrome and have tried in dev mode and a deployed app. Below is the code that I am using.
NOTE: the javascript code came from http://playground.html5rocks.com/#simple_notifications and it worked fine in chrome.
是否有人去做?
public native void requestPermission() /*-{
$wnd.webkitNotifications.requestPermission();
}-*/;
public native void createJSNotification(String iconUrl, String title, String body) /*-{
$wnd.webkitNotifications.createNotification(iconUrl, title, body).show();
}-*/;