通知ウィンドウからページにメッセージを送信する必要があります。それを行う方法私は次のページを持っています
var shownotif=0;
Set notification permissions for this page Show HTML Notification /* * Common code */ document.querySelector('#request_permission').addEventListener('click', function() {
window.webkitNotifications.requestPermission(); }, false);
// see the HTML section to see the button var url = 'index212.html'; document.querySelector('#show_html_notification').addEventListener('click', function() {
if (window.webkitNotifications.checkPermission() == 0) {
// you can pass any url as a parameter
notif=window.webkitNotifications.createHTMLNotification(url);
notif.addEventListener('display', function() {
///alert(111);
// notif.cancel();
}
);
notif.addEventListener('click', function(g, g2) {
setTimeout("tkfnm",1000);
alert(jQuery.cookie("ca2"));
// notif.cancel();
}
);
notif.show(); // note the show()
} else {
alert("This page doesn't have permission to show notifications yet.");
} }, false);
ユーザーが通知ウィンドウをクリックしたときに、「親」で私の情報をメッセージに送信するようにしたいと思います。