Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications are not silent in chrome #253

Open
NamanSharma5 opened this issue May 18, 2020 · 10 comments
Open

Notifications are not silent in chrome #253

NamanSharma5 opened this issue May 18, 2020 · 10 comments

Comments

@NamanSharma5
Copy link

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.

@kg-kartik
Copy link

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.

@theLufenk
Copy link
Collaborator

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

@kg-kartik
Copy link

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

@theLufenk
Copy link
Collaborator

Please specify the OS and Browser versions. Thanks

@kg-kartik
Copy link

OS -Windows
Chrome Version - 84

@NamanSharma5
Copy link
Author

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
                            }
                        )

@theLufenk
Copy link
Collaborator

@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
Copy link
Collaborator

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

@mapokapo
Copy link

@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.

@kofifus
Copy link

kofifus commented Oct 19, 2021

I submitted #286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants