Preference to block notifications by default

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
Keiji
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2017-09-27, 19:31

Preference to block notifications by default

Unread post by Keiji » 2019-01-13, 12:35

I'd like to be able to block all push notifications by default - i.e. prevent the "do you want to allow notifications for this site?" pop up from appearing when requested by JavaScript - but still be able to allow individual sites.

I've searched around a bit and can't see any way to do this in Pale Moon, Waterfox, or Firefox. The closest I've found is this answer for Firefox 59, but the text in the screenshot implies there would be no way to manually allow notifications for a specific site afterwards, so it wouldn't really work for me. Setting "dom.webnotifications.enabled" to false is also not a solution as it does not allow notifications from any site.

If there's an extension that does this, instead of a native browser feature, that'd work just fine too.

My reasoning is as follows: there are a couple of select sites I would like to receive notifications from. However, 99% of websites that request notifications permissions are news websites which just want to use the facility to send me spam. If I'm on a news website it's usually because I was linked there as a source from another article, and it's usually a completely different website every time, so even though I block the request every time, it doesn't prevent future popups because it only applies to each individual site.

Restricting JavaScript's ability to open the notifications popup to clicks is no use, as some sites now force you to click a button to get rid of a modal before you can read anything on the page, and they then request notification permission on that click.

Is there anything that can be done about this? I'm sure I'm not the only one in this situation.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35481
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Preference to block notifications by default

Unread post by Moonchild » 2019-01-13, 13:09

There is currently no way to "block by default with exceptions" in the browser, sorry.
Perhaps there is an extension that can help you, or one can be created to enhance this functionality.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Michaell
Lunatic
Lunatic
Posts: 282
Joined: 2018-05-26, 18:13

Re: Preference to block notifications by default

Unread post by Michaell » 2019-01-13, 23:52

If you have dom.webnotifications.enabled set to false, you can right click on a page, choose Page Info, then Permissions tab, look down list for Show Notifications, uncheck Default, and select Allow.

I don't have a site handy to test on. If it doesn't work the way you want, sorry, was worth a shot.
Win10home(1709), PM33.0.0-portable as of Feb 1, '24

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35481
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Preference to block notifications by default

Unread post by Moonchild » 2019-01-14, 02:46

NotWorthKnowing wrote:If you have dom.webnotifications.enabled set to false, you can right click on a page, choose Page Info, then Permissions tab, look down list for Show Notifications, uncheck Default, and select Allow.

I don't have a site handy to test on. If it doesn't work the way you want, sorry, was worth a shot.
That doesn't work because you're setting it globally disabled.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Keiji
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2017-09-27, 19:31

Re: Preference to block notifications by default

Unread post by Keiji » 2019-01-16, 04:23

Moonchild wrote:There is currently no way to "block by default with exceptions" in the browser, sorry.
Perhaps there is an extension that can help you, or one can be created to enhance this functionality.
No need to apologise. That's why I'm posting it as a suggestion and asking if anyone knows of such an extension. :)
NotWorthKnowing wrote:If you have dom.webnotifications.enabled set to false, you can right click on a page, choose Page Info, then Permissions tab, look down list for Show Notifications, uncheck Default, and select Allow.

I don't have a site handy to test on. If it doesn't work the way you want, sorry, was worth a shot.
Changing the setting in Page Info would be fine, in fact Page Info gives the options "Use default (Ask) | Allow | Block".
If only there were a way to change "Use default (Ask)" to "Use default (Block)" - even if only accessible via about:config - that would work wonders.

Michaell
Lunatic
Lunatic
Posts: 282
Joined: 2018-05-26, 18:13

Re: Preference to block notifications by default

Unread post by Michaell » 2019-01-16, 13:40

Yea, if only! :roll: Did you even try? Toggle the pref in about:config, then the "default" in Permissions will be block.
Win10home(1709), PM33.0.0-portable as of Feb 1, '24

Keiji
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2017-09-27, 19:31

Re: Preference to block notifications by default

Unread post by Keiji » 2019-01-19, 13:21

Wait, hold on:

I just found the about:permissions page, where I can select All Sites, and then change the default to Block, while it still works just fine for sites where it is enabled...

This was linked to from the settings icon on a desktop notification, but funnily enough doesn't seem to be linked to from the usual permissions request popup.

Legit sites are wise enough to tell me desktop notifications are blocked, and I can then go to about:permissions and enable notifications on that site.

I'm surprised I didn't find this in a search, also that Moonchild didn't suggest this method...!

Either way, works for me! Hopefully anyone else wanting this feature will find this post helpful.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35481
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Preference to block notifications by default

Unread post by Moonchild » 2019-01-19, 20:34

I would have suggested it if it weren't for the fact that "all sites" -> "Block" actually toggles the feature pref dom.webnotifications.enabled to false -- meaning no notifications would work at all in that case. If they still do, then there's something wrong with the code, since if the API is disabled, NO notifications should work.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Michaell
Lunatic
Lunatic
Posts: 282
Joined: 2018-05-26, 18:13

Re: Preference to block notifications by default

Unread post by Michaell » 2019-01-19, 22:14

Probably better as is. But if you do change it, maybe add a pref for wenotifications.default [0/1]. And if it is changed the current UI (Page Info/Permissions) would be wrong, or would need to correspond to the new default pref, because right now it allows unchecking default and changing to allow, at least visually (what actually happens is another matter).
Win10home(1709), PM33.0.0-portable as of Feb 1, '24

Keiji
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2017-09-27, 19:31

Re: Preference to block notifications by default

Unread post by Keiji » 2019-01-25, 18:24

Moonchild wrote:I would have suggested it if it weren't for the fact that "all sites" -> "Block" actually toggles the feature pref dom.webnotifications.enabled to false -- meaning no notifications would work at all in that case. If they still do, then there's something wrong with the code, since if the API is disabled, NO notifications should work.
Ah... this does make sense.

I've done some further testing and I think I understand what happens now:

1. If you start Pale Moon when "all sites" is set to "Block", notifications won't work even on sites that have it set to "Allow"
2. If you then change "all sites" to "Always Ask", notifications start working again on allowed sites and ask on others
3. If you then change "all sites" back to "Block", notifications still work on allowed sites, while the permission request popup is blocked from others.
4. If you then restart Pale Moon without changing anything, you go back to step 1 and notifications stop working on allowed sites.

So the fact that I changed it from "Always Ask" to "Block" without restarting afterwards is why I didn't see the behavior you described. I would agree that that's a bug, as the config setting isn't doing what it's supposed to do, though at the same time the option in about:preferences isn't really reflecting the correct setting, as there isn't a correct setting for it to reflect.

User avatar
bawldiggle
Lunatic
Lunatic
Posts: 446
Joined: 2013-02-22, 21:16
Location: East Coast Australia

Re: Preference to block notifications by default

Unread post by bawldiggle » 2019-02-01, 02:28

I am being plagued by this on every window, even when editing posts with every preview ...
notifications nag on sevenforums.png
I have always been satisfied with ...
notifications on PM already.png
notifications on PM already.png (10.15 KiB) Viewed 896 times
If I block notifications will it affect the classical notification I have been satisfied with for years.
The notification nags only started in the last 24 hours on SevenForums.com ...

From reading previous posts the notifications "popup" are website based ...OR... controlled by PaleMoon ?
I am confused :crazy:
Win-7 PRO 64-bit
Palemoon; auto updates current version (32-bit)

Locked