I successfully integrated OneSignal push notifications in my Phoenix app. But the subscription is working only on the Safari browser. If I try to do from Chrome and Firefox the subcsribtion is not updated in dashboard.
/lib/my_app_web/templates/layouts/root.html.heex
<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>
<script>
window.OneSignalDeferred = window.OneSignalDeferred || [];
OneSignalDeferred.push(async function(OneSignal) {
await OneSignal.init({
appId: "one_signal_app_id",
notifyButton: {
enable: true,
},
allowLocalhostAsSecureOrigin: true
});
});
</script>
Firefox browser I got this. below error:
[Service Worker Installation] Installing service worker failed SecurityError: ServiceWorkerContainer.register: Script URL is not same-origin with Client