The goal is to allow partners to trigger an external window where users can opt into receiving push notifications. Once the user grants or denies permission, the opt-in window is automatically closed so the user can continue browsing the original website.

Awesome! How does it work?

Execute this JavaScript snippet when you want to trigger the opt-in window. e.g., when the user clicks a button or submits a form.

var optinWindow ='');

Why is this necessary?

As a security measure, browsers will only allow you to close a window via JavaScript if that window was opened via JavaScript, therefore we have to open the window with JavaScript so we can conveniently close it after the user grants or denies permission.