webpush-ios-example icon indicating copy to clipboard operation
webpush-ios-example copied to clipboard

This sample web do not work in my server

Open marcoahp opened this issue 1 year ago • 1 comments

I've published this sample web in my server replacing the vapid key with my own one generated with your instructions, but when I push the suscribe to notifications button, I get an error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pushManager') at subscribeToPush (frontend.js:44:35)

What is the problem? (I use Microsoft IIS)

Problem Solved. I had to change the scope in register: let swRegistration = await navigator.serviceWorker.register('https://******./serviceworker.js', {scope: '/'})

This sample works fine in android devices. Is possible to make it works in chrome for desktop too?

marcoahp avatar Oct 11 '24 07:10 marcoahp

Hello! You can check in "chrome for desktop" original example https://andreinwald.github.io/webpush-ios-example If it works - then answer in changes that you did or should do in your version of code.

andreinwald avatar Oct 11 '24 09:10 andreinwald

Hello, Where could I find chrome for desktop original example?

marcoahp avatar Oct 15 '24 07:10 marcoahp

https://andreinwald.github.io/webpush-ios-example

Works in my Chrome on MacOS

andreinwald avatar Oct 15 '24 12:10 andreinwald

Ok, I thought that It worked in chrome for windows too. But not. Thanks

De: Andrii Reinvald @.> Enviado el: martes, 15 de octubre de 2024 14:34 Para: andreinwald/webpush-ios-example @.> CC: marcoahp @.>; Author @.> Asunto: Re: [andreinwald/webpush-ios-example] This sample web do not work in my server (Issue #2)

https://andreinwald.github.io/webpush-ios-example

Works in my Chrome on MacOS

— Reply to this email directly, view it on GitHub https://github.com/andreinwald/webpush-ios-example/issues/2#issuecomment-2413790794 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AL3J4T5NP4GR5J2CPEQI7U3Z3UDVHAVCNFSM6AAAAABPYLEG66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJTG44TANZZGQ . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AL3J4TZAUTCFCSMB7IEF23TZ3UDVHA5CNFSM6AAAAABPYLEG66WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUP36DEU.gif Message ID: @.*** @.***> >

marcoahp avatar Oct 15 '24 14:10 marcoahp