Chrome does not support the Window.webkitNotifications.createNotification message notification API.

Source: Internet
Author: User

Surprised to find today, CHROME22 has not supported the Window.webkitNotifications.createHTMLNotification method:

However, you can continue to use it in Chrome extension, such as the page performance detection feature in Fehelper:

What is Google doing here? Gradually to achieve their own standardization?

WEB notification does not createhtmlnotification such a method, or even createnotification.

Instead, it is a simple constructor:

varnotification = newNotification("我的消息",{    body : ‘内容‘,    iconUrl : ‘图标‘,    tag : {}, // 可以加一个tag});notification.show();

It seems that only Chrome has this API right now:

After the rewrite:

<!DOCTYPE HTML><HTML><Head><title>Google Desktop Notifications</title><Metaname= "Generator"content= "EditPlus" /><Metaname= "Author"content="" /><Metaname= "keywords"content="" /><Metaname= "description"content="" /><Metahttp-equiv= ' Content-type 'content= ' text/html;CharSet=utf-8 '/></Head><Body><ButtonID= ' btn '>Show Desktop Notifications</Button> <Scripttype= ' Text/javascript '>Document.queryselector ("#btn"). AddEventListener ('Click', notify,false);functionNotify () {if(window.webkitnotifications) {Console.log (123); if(Window.webkitNotifications.checkPermission ()== 0) {            varnotification_test=Window.webkitNotifications.createNotification ("http://images.cnblogs.com/cnblogs_com/flyingzl/268702/r_1.jpg", 'title', 'content'+NewDate (). GetTime ()); Notification_test.display= function() {} Notification_test.onerror= function() {} Notification_test.onclose= function() {} Notification_test.onclick= function() { This. Cancel (); Notification_test.replaceid= 'Meteoric';                                    Notification_test.show (); varTemppopup=window.webkitNotifications.createHTMLNotification (["http://www.baidu.com/", "http://www.soso.com"][math.random ()>= 0.5 ? 0 : 1]); Temppopup.replaceid= "Meteoric_cry";        Temppopup.show (); } Else{window.webkitNotifications.requestPermission (notify); }    } Else{Console.log (456); varNotification= NewNotification ("my message.", {body:'content', IconUrl:'Https://dn-st.b0.upaiyun.com/v4.9.x/images/49751d86.touch-icon-ipad.png', tag: {}//You can add a tag        });    Notification.show (); } }</Script></Body></HTML>

Note: The red section above is the new Chrome pop-up popup notification feature

Chrome does not support the Window.webkitNotifications.createNotification message notification API.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.