If you have a requirement to open the PC Notification bar on your local H5 page, try Notification~
Supported browsers Google, Firefox, and Safari do not support IE
// There is a desktop notification bar function
if (window.Notification) {
Notification.requestPermission((result) = > {
// Refuse to open the notification bar
if(result.data == 'denied') return;
// Agree to open the notification bar
if (result == 'granted') {
let notification = new Notification('You have news.', {
body: 'You have opened the XXX desktop popover'./ / body
icon: 'http://www.xxx.com' / / picture
})
// Click the notification bar event
notification.onclick = () = > {
// Click and execute to return to the notification bar launch page
window.focus(); }}})}Copy the code