Search code examples
internet-explorerweb-push

'navigator.serviceWorker' is undefined for Internet Explorer


I've created a Web Push notification system for browsers to alert members when certain actions are taken on their account.

I developed the system using Chrome and Firefox, everything is working nicely. Then I did some cross-browser checking and found that Internet Explorer (11) was having a problem where the 'serviceWorker' does not exist under 'navigator'.

Before registering my service worker, I do a check to see if it is available. It is always 'undefined' for IE, but is fine in the other browsers.

  if (navigator.serviceWorker == 'undefined') {
    return false;
  }

Does this mean that the browser does not support service workers and push notifications? Is it a preference or security setting which needs to be changed within the browser?

I don't use IE much, but I'm sure it supports Push Notifications, but I can't find any references on the web as to the cause of this being unavailable.


Solution

  • You cannot use Service Workers with IE. Look here:

    https://caniuse.com/#search=serviceWorker

    But as you can see you can use them in Chrome, Firefox... as you said.