In OneSignal, there is a problem with push notifications for iOS and iPad Safari.

■Main topic

Using OneSignal, I installed a push notification function in my web application. In Safari on iOS and iPadOS Only in the following specific cases, push notifications will not be delivered to the terminal unless the conditions are met.

When the conditions are met, the accumulated push notifications It arrives all at once like a dam has broken.

Please tell me how to solve it.

■Specific cases

  • When in the foreground (for pages other than admin.php)
  • When in the background (when displaying a page other than admin.php and putting it in the background)

■Conditions

・Page transition to admin.php with window back ・Page transition with <a>,<input type="submit">

■Supplement

Only admin.php has read the following files.

  • manifest.json
  • https://cdn.onesignal.com/sdks/OneSignalSDK.js
  • process_push_tokens.js (OneSignal.init(), OneSignal.on(), and the process of saving tokens to the database are described)

■Tried

I read the three files listed in the above supplement on a page other than admin.php, but when I did so, I could not receive push notifications when admin.php was displayed.

Replies

■Multi Post

I have the same question on the site above.

The reason is that it is a fairly niche question, I just want to increase my chances of getting it resolved. I will let you know when this question is resolved.

■Code

manifest.json

{
    "$schema": "https:&#x2F;&#x2F;json.schemastore.org&#x2F;web-manifest-combined.json",
    "name": "name",
    "short_name": "short_name",
    "display": "fullscreen"
  }

process_push_tokens.js


  window.OneSignal = window.OneSignal || [];
  OneSignal.push(function () {

    OneSignal.init({
      appId: "my_app_id",
      safari_web_id: "my_safari_web_id",
      welcomeNotification: [
        {
          title: "title",
          message: "message"
        }
      ],
      promptOptions: {
        slidedown: {
          prompts: [
            {
              type: "push",
              autoPrompt: false, &#x2F;&#x2F; 自動表示しない
              text: {
                actionMessage: "***?",
                acceptButton: "許可する",
                cancelButton: "後で"
              },
              delay: {
                pageViews: 1,
                timeDelay: 1
              }
            }
          ]
        }
      }
    });
    
    OneSignal.showSlidedownPrompt(); &#x2F;&#x2F; 手動でダイアログを表示する
    
    
    OneSignal.on(&#039;subscriptionChange&#039;, function (isSubscribed) { &#x2F;&#x2F; プッシュ通知を許可した際の処理
      if (isSubscribed) {
        OneSignal.getUserId(function(userId) {
          insert_token(userId);
        });

      }
    });
  });