[Web Notify] Any way to preempt notification if site is already open and focused?

We would like to write some code to check whether the site is already opened and focused before showing a push notification, so we can display the information directly in the page by some other means. Otherwise, there is an awkward user experience where clicking on the notification opens another tab and loads the page a second time. For reference, this is a Common Notification Pattern in Google Developer Web Fundamentals. (https://developers.google.com/web/fundamentals/push-notifications/common-notification-patterns)

To do this, we would need to modify or extend the service worker with some custom code. I suppose we could try to modify the (somewhat) minified contents of https://aswpsdkus.com/notify/v1/ua-sdk.min.js and insert that directly into push-worker.js, but that seems like a brittle solution that would likely be broken any time the sdk is updated. Do you offer a un-minified version of the push worker code, or any supported method to extend it?

 

Thanks for your time!

 

 

Didn't find what you were looking for?

New post

Comments

1 comment

  • Hello Bridget, 

     

    This is Mikey with Airship Technical Support. My apologies for the delayed reply to your question. As you have observed, there isn't a way to support this behavior without extending the service worker. We also don't provide any support for doing so at this time. That being said, this is something that would be great to have the ability to facilitate, and so I have put in a product enhancement request on your behalf. 

     

    Thanks for your question, while I don't have any timeline for such a request to be implemented it is something that we will be looking into. 

    Please let me know if you have any follow up questions that I can answer for you regarding this. 

     

    Best regards, 

     

    Mikey R.

    Airship | Technical Support Engineer | Portland, OR

    Comment actions Permalink
    0

Please sign in to leave a comment.