它会在PC上的Chrome中打开传递的网址,但是当它在Android上点击时会打开服务工作者吗?
//服务工
self.addEventListener("push", function(event) {
const data = event.data.json();
event.waitUntil(
self.registration.showNotification(data.title,
{
body: data.body,
icon: data.icon,
tag: data.tag,
data: {
url: data.url
}
})
);
});
self.addEventListener("notificationclick",function(event) {
event.notification.close();
return clients.openWindow(event.notification.data.url);
});