dimanche 28 février 2016

Chrome push Notification

Hi I am trying to build push notification, i tried to implementing a random code which is referred from web. the code goes as follows :

**notification.html**-->

    
        function shows(){

        var notify= webkitNotifications.createNotification('icon48.png','My notification',
        'hi buddy');    
        notify.show();
        }
        if(webkitNotifications){
            setInterval(function()
            {
                shows();
                }, 1000);
        }else{
        chrome.tabs.create({url : "error.html"})
        }

        

    error.html--->
    

there is an error in your extension



    manifest.JSON -->

         {
            "manifest_version": 2,
          "name": "My Extension",
          "version": "1",
            "description" : "Display every 5 sec",
            "icons" : {"48" :"icon48.png"},
            "permissions" : ["tabs","notifications"],
            "background": {"page": "notifications.html"}
        }

 

The problem is Extension is loaded in chrome but it doesn't responds to the code and the notification is now shown. :( please help.




Aucun commentaire:

Enregistrer un commentaire