blob: d0fd871731d6ef8c98e4d9cc937d5a05cd4a3115 [file] [log] [blame]
<!DOCTYPE html>
Open this page through a web server in two views. If necessary request permission to post web notifications: <button onclick="requestPermission()">Request permission</button><br/>
Then post this permission once in each page. <button onclick="postNotification()">Post notification</button><br/>
Click on the notification. Only the second notification should be closed on the second page.
<p id="console">
function requestPermission() {
if (Notification.permission == "granted") {
log("Notification already granted");
log("Requesting permission...");
Notification.requestPermission(function(permission) {
if (Notification.permission == "granted") {
log("Notification granted");
log("Notification denied");
function postNotification() {
var n = new Notification("Notification title");
n.onshow = onShowHandler;
n.onclick = onClickHandler;
n.onclose = onCloseHandler;
function log(message) {
document.getElementById("console").innerHTML += message + "<br/>";
function onShowHandler() {
log("onshow handler called");
function onClickHandler() {
log("onclick handler called");
function onCloseHandler() {
log("onclose handler called");