PHP Classes

File: PNTestClient.html

Recommend this page to a friend!
  Classes of Stefan Kientzler  >  PHP Web Push Notifications Server  >  PNTestClient.html  >  Download  
File: PNTestClient.html
Role: Auxiliary data
Content type: text/plain
Description: Example HTML page client
Class: PHP Web Push Notifications Server
Queue and push notifications to Web users
Author: By
Last change:
Date: 2 years ago
Size: 2,147 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>PUSH Notifications Client</title> <script src="PNClient.js"></script> <script> function Load() { var msg = 'Secure context: '; msg += window.isSecureContext ? 'true<br/>' : 'false<br/>'; msg += 'Notification: '; msg += ('Notification' in window) ? 'defined<br/>' : 'not defined<br/>'; msg += 'PushManager: '; msg += ('PushManager' in window) ? 'defined<br/>' : 'not defined<br/>'; msg += 'serviceWorker: '; msg += ('serviceWorker' in navigator) ? 'defined<br/>' : 'not defined<br/>'; msg += 'Notification.permission: ' + window.Notification.permission + '<br/>'; window.Notification.permission document.getElementById('msg').innerHTML = msg; if (window.Notification.permission === "denied") { document.getElementById('subscribe').innerHTML = 'Permission was denied in the past...'; } else { var strMsg; pnSubscribed() .then(function(subscribed) { if (subscribed) { document.getElementById('msg').innerHTML = 'PUSH Notifications are subscribed<br/><br/>' + msg; } else { document.getElementById('msg').innerHTML = 'PUSH Notifications not subscribed so far<br/><br/>' + msg; } }); } } </script> </head> <body onload="Load()"> <h2>Welcome to PUSH Notifications Client</h2> <div id=subscribe> <button id="reg-btn" onclick="pnSubscribe()">Subscribe PUSH Notifications</button><br/><br/> <button id="unreg-btn" onclick="pnUnsubscribe()">Unregister Service worker</button><br/><br/> <button id="unreg-btn" onclick="pnUpdate()">Update Service worker</button><br/><br/> </div> <div id=msg style="font-weight: bold;"></div> </body> </html>