If web push notifications are functioning on browsers like Chrome and Firefox but failing on Safari, the issue is typically related to Safari's unique configuration requirements. Unlike other browsers that use the standard Push API, Safari additionally requires some specific setups.
Follow these steps to troubleshoot and resolve Safari integration issues:
1. Verify Your safariWebsitePushID
Your safariWebsitePushID is a crucial parameter that must be correctly configured in your Pushwoosh initialization script.
- It must match your website's domain. The ID is created in your Apple Developer account and must correspond to the domain where you are implementing push notifications.
-
It must be in reverse-domain name format. For example, if your website is
www.my-awesome-site.com, your Website Push ID should beweb.com.my-awesome-site.
Check that the safariWebsitePushID value in your code matches the one from your Apple Developer account and corresponds to the correct domain.
Pushwoosh.push(['init', {
logLevel: 'info',
applicationCode: 'XXXXX-XXXXX',
apiToken: 'xxxxxxx',
safariWebsitePushID: 'web.com.your-domain',
// ... other options
}]);2. Check the Apple Website Push Certificate
The most common point of failure is the certificate associated with your Website Push ID.
- Certificate and Domain Mismatch: Ensure the certificate you generated in your Apple Developer account is issued for the exact domain where the SDK is running. A mismatch between the certificate's domain and your site's actual domain will prevent registration.
-
Staging vs. Production: If you are testing on a staging domain (e.g.,
staging.my-site.com), you need a separate Website Push ID and certificate configured for that specific subdomain.
3. Regenerate and Reconfigure the Certificate
If you have confirmed the safariWebsitePushID is correct but the issue persists, the certificate itself may be misconfigured or corrupted. Regenerating it is often the simplest solution.
- Go to your Apple Developer account.
- Create a new Website Push ID and/or certificate, ensuring it is tied to the correct domain.
- Upload the new certificate to your Pushwoosh Control Panel.
- Update the
safariWebsitePushIDin your website's code if you created a new one.
4. Ensure Explicit Subscription
Safari requires a direct user action to trigger the push permission prompt. Ensure that Pushwoosh.subscribe() is called when a user clicks a "Subscribe" button — your custom one or provided by Pushwoosh (see. Default or Custom Subscription Popup / Subscription Button). If you are using a custom button, make sure autoSubscribe is set to false in your init options.
Comments
0 comments
Article is closed for comments.