push.js icon indicating copy to clipboard operation
push.js copied to clipboard

Notifications are not silent in chrome

Open NamanSharma5 opened this issue 4 years ago • 10 comments

Hi I am trying to use the silent option of Push.js but it is still making noise in Chrome, when I receive notifications. I am running this on a server with the files stored under the public directory.

My code is: Push.create('Message',{ timeout:5000, onClick: function(){ window.focus(); this.close; }, silent:true }

Help me please.

Thank you.

NamanSharma5 avatar May 18 '20 20:05 NamanSharma5

Does push.js even shows notification in chrome if you are using localhost,i.e , http connection..In my case it is working well in edge but i cant see any notification in chrome ? So, I infer that chrome is blocking notification on sites with insecure http connection as it blocks Notifications from Notification API.

kg-kartik avatar Jul 31 '20 09:07 kg-kartik

Notification API should work fine in localhost. Please check that you have not denied push permission.

theLufenk avatar Jul 31 '20 09:07 theLufenk

No , I have allowed notifications and popups . The promise is being fulfilled, it is just that notification is not showing up.

kg-kartik avatar Jul 31 '20 10:07 kg-kartik

Please specify the OS and Browser versions. Thanks

theLufenk avatar Jul 31 '20 10:07 theLufenk

OS -Windows Chrome Version - 84

kg-kartik avatar Jul 31 '20 10:07 kg-kartik

Returning to the principal issue, @theLufenk , @kg-kartik , @vlazar & @Calinou do you know why silent notifications are not working? I have made sure to the pass in the silent: true parameter and my notifications are coming through - just not silently. I am using localhost for dev and heroku for live versions. Does not work on Chrome or Firefox (both run on Windows).

Sample code:

                        Push.create('Sit',{
                            tag: 'Warning',
                            body:"Hi ",
                            timeout:5000, //in ms
                            onClick: function(){
                                window.focus();
                                this.close;
                                },
                            silent:true
                            }
                        )

NamanSharma5 avatar Jul 31 '20 15:07 NamanSharma5

@NamanSharma5
silent is only supported on Mobile Chrome in the latest version.

Would be simple enough to add support for it here I believe.

A Pull Request is always welcome :)

theLufenk avatar Jul 31 '20 17:07 theLufenk

@kg-kartik Could you please open a separate issue for your question. Thanks.

theLufenk avatar Jul 31 '20 17:07 theLufenk

@theLufenk Why not just use all of the fields found under Notification API Instance properties?

As of now, only body, icon, tag, and requireInteraction are actually used, out of the 15 that are provided in the API.

mapokapo avatar Jan 10 '21 19:01 mapokapo

I submitted https://github.com/Nickersoft/push.js/pull/286

kofifus avatar Oct 19 '21 08:10 kofifus