generated at
Web Notifications API

Chrome for Androidでは、ServiceWorkerRegistration.showNotification()経由でなら呼び出せるらしい?
scrapboxだと拒否されて動かなかった
権限をリセットしてもだめ
service workerに管理されている?
別のweb appとして動かすしかなさそう
js
const button = document.createElement("button"); button.style.position = "fixed"; button.style.top = "20%"; button.style.left = "5%"; button.textContent = "Notify me"; button.addEventListener("click", async () => { try { const permission = await Notification.requestPermission(); if (permission !== "granted") { alert(`Permission: ${permission}`); return; } const registration = await navigator.serviceWorker.ready; registration.showNotification("バイブレーションの例", { body: "ブンブン! ブンブン!", icon: "../images/touch/chrome-touch-icon-192x192.png", vibrate: [200, 100, 200, 100, 200, 100, 200], tag: "vibration-sample", }); button.remove(); } catch(e) { alert(`${e.name} ${e.message}\n\n${e.stack}`); throw e; } }); document.body.append(button);

#2023-04-13 19:47:56