title: Firebase web push notification, on click not working
body: <p>From days since I am trying to get it done, but I am totally stuck at this point.</p>
  
  <p>Here is the code from my service worker file</p>
  
  <pre><code>importScripts('https://www.gstatic.com/firebasejs/6.0.2/firebase-app.js');
  importScripts('https://www.gstatic.com/firebasejs/6.0.2/firebase-messaging.js');
  
  firebase.initializeApp({
      messagingSenderId: "xxxxxxxxxxxx"
  });
  
  var messaging = firebase.messaging();
  
  
  messaging.setBackgroundMessageHandler(function(payload) {
  
      console.log('[firebase-messaging-sw.js] Received background message ', payload);
      // Customize notification here
      var notificationTitle = payload.data.title; //or payload.notification or whatever your payload is
      var notificationOptions = {
        body: payload.data.body,
        icon: payload.data.icon,
        image: payload.data.image,
  
        data: { url:payload.data.openURL }, //the url which we gonna use later
        actions: [{action: "open_url", title: "View"}]
      };
  
      return event.waitUntil(self.registration.showNotification(notificationTitle,
        notificationOptions));
  });
  
   self.addEventListener('notificationclick', function(event) {
  
  
      console.log('event = ',event);
      event.notification.close();
      event.waitUntil(clients.openWindow(event.notification.data.url));
  
      switch(event.action){
        case 'open_url':
          window.open(event.notification.data.url);
        break;
        case 'any_other_action':
          window.open(event.notification.data.url);
        break;
      }
  
  
  }, false);
  </code></pre>
  
  <p>And data is in this format</p>
  
  <pre><code>$data=[
          'title' =&gt; 'message title',
          'body' =&gt; 'description body',
          'icon' =&gt; 'https://i.ytimg.com/vi/gXSyP9ga-ag/hqdefault.jpg',
          'image'=&gt;'https://i.ytimg.com/vi/gXSyP9ga-ag/mqdefault.jpg',
          'openURL'=&gt;'https://google.com'
        ];
  </code></pre>
  
  <p>Now there are many issue.</p>
  
  <ul>
  <li><p>when push notification body is clicked on mobile, it does not open the url, but only dismisses it (only clicking action button opens link</p></li>
  <li><p>I did some reading online and found that</p>
  
  <pre><code>event.waitUntil(clients.openWindow(event.notification.data.url));
  </code></pre>
  
  <p>Does not work with safari and safari iPhone, can someone help me find
  out how to implement a click even listener that will work with apple
  devices?</p></li>
  </ul>
  
  <p>Any help would be appreciated </p>