[offtopic] JavaScript and ServiceWorkers in FireFox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



This is a bit off-topic but the question exists due to the FireFox in CentOS 7.

Few websites I have visited (e.g. LiveScience.com) the browser asks me if it can give me notifications.

I always say no because of bad experiencies with notifications on Android where notification spam is the largest reason why I dislike the Android operating system (screwed up update system is the second reason, I'm a tree hugging save the planet hippie so I don't buy a new phone every two weeks but instead wait until mine breaks, so its often weeks or months before I actually get updates that exist)

Anyway I have never allowed a website to send me notifications but I now have use to make notifications available to users on one of my sites if they opt in.

Looking into how they are done, it seems to involve serviceWorkers which I have heard about but never used myself.

Going through a simple tutorial I created this function:

function registerWorker() {
    "use strict";
    if ('serviceWorker' in navigator) {
        window.alert('Hello World');
    } else {
        window.alert('no joy');
    }
}

obviously not finished as it doesn't register anything, but it kept telling me "no joy" in CentOS FireFox.

After a little research I found that FireFox 45 ESR has serviceWorkers but they are disabled by default. I had to go to about:config and find the line

dom.serviceWorkers.enabled

and change it from False to True

But then it dawned on me, if they are not enabled, then how are other sites asking me if I want to allow notifications from the site?

Are they asking me before they have detected whether or not my browser supports it, or is there a different mechanism for notifications that doesn't involve Service Workers?

Does anybody know?

-=-

Basically my use is an audio site, there's not much reason to visit the site if the user has all the audios they are interested in, and we don't do e-mail notifications for privacy reasons.

Would like to be able to notify users who opt-in that new audios are available from performers they are interested in if they opt-in to notifications *without* needing their e-mail address.

It looks like serviceWorkers are needed for that, but it puzzles me that other sites (more than just liveScience) have offered me notifications when the FireFox in CentOS by default has the API disabled, so I'm wondering if there is a different API I just do not know about?
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux