PWA in ios, prevent to add home screen multiple time












0















PWA app is not working properly in ios like, in android if you add an app into your homescreen next time it wouldn't allow you to add it will show the message like app is already installed in your phone but in ios it is allowing to add n number of time which is not good if user have app already then why they will add it multiple time.



Can anyone pls help me on this?
Can we resolve this issue?
Please suggest something like is it a limitation in ios for pwa!



const isIos = () => {
const userAgent = window.navigator.userAgent.toLowerCase();
return /iphone|ipad|ipod/.test(userAgent);
}
const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone);
if (isIos() && !isInStandaloneMode()) {
var deferredPrompt;
window.addEventListener('beforeinstallprompt', function (e) {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
var display = true;
setInterval(function () {
document.getElementById("balloonMessage").style.display = display ? "none" : "block";
display = !display;
}, 5000);
});
}









share|improve this question





























    0















    PWA app is not working properly in ios like, in android if you add an app into your homescreen next time it wouldn't allow you to add it will show the message like app is already installed in your phone but in ios it is allowing to add n number of time which is not good if user have app already then why they will add it multiple time.



    Can anyone pls help me on this?
    Can we resolve this issue?
    Please suggest something like is it a limitation in ios for pwa!



    const isIos = () => {
    const userAgent = window.navigator.userAgent.toLowerCase();
    return /iphone|ipad|ipod/.test(userAgent);
    }
    const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone);
    if (isIos() && !isInStandaloneMode()) {
    var deferredPrompt;
    window.addEventListener('beforeinstallprompt', function (e) {
    // Prevent Chrome 67 and earlier from automatically showing the prompt
    e.preventDefault();
    // Stash the event so it can be triggered later.
    deferredPrompt = e;
    var display = true;
    setInterval(function () {
    document.getElementById("balloonMessage").style.display = display ? "none" : "block";
    display = !display;
    }, 5000);
    });
    }









    share|improve this question



























      0












      0








      0








      PWA app is not working properly in ios like, in android if you add an app into your homescreen next time it wouldn't allow you to add it will show the message like app is already installed in your phone but in ios it is allowing to add n number of time which is not good if user have app already then why they will add it multiple time.



      Can anyone pls help me on this?
      Can we resolve this issue?
      Please suggest something like is it a limitation in ios for pwa!



      const isIos = () => {
      const userAgent = window.navigator.userAgent.toLowerCase();
      return /iphone|ipad|ipod/.test(userAgent);
      }
      const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone);
      if (isIos() && !isInStandaloneMode()) {
      var deferredPrompt;
      window.addEventListener('beforeinstallprompt', function (e) {
      // Prevent Chrome 67 and earlier from automatically showing the prompt
      e.preventDefault();
      // Stash the event so it can be triggered later.
      deferredPrompt = e;
      var display = true;
      setInterval(function () {
      document.getElementById("balloonMessage").style.display = display ? "none" : "block";
      display = !display;
      }, 5000);
      });
      }









      share|improve this question
















      PWA app is not working properly in ios like, in android if you add an app into your homescreen next time it wouldn't allow you to add it will show the message like app is already installed in your phone but in ios it is allowing to add n number of time which is not good if user have app already then why they will add it multiple time.



      Can anyone pls help me on this?
      Can we resolve this issue?
      Please suggest something like is it a limitation in ios for pwa!



      const isIos = () => {
      const userAgent = window.navigator.userAgent.toLowerCase();
      return /iphone|ipad|ipod/.test(userAgent);
      }
      const isInStandaloneMode = () => ('standalone' in window.navigator) && (window.navigator.standalone);
      if (isIos() && !isInStandaloneMode()) {
      var deferredPrompt;
      window.addEventListener('beforeinstallprompt', function (e) {
      // Prevent Chrome 67 and earlier from automatically showing the prompt
      e.preventDefault();
      // Stash the event so it can be triggered later.
      deferredPrompt = e;
      var display = true;
      setInterval(function () {
      document.getElementById("balloonMessage").style.display = display ? "none" : "block";
      display = !display;
      }, 5000);
      });
      }






      javascript angularjs asp.net-mvc polymer-1.0 progressive-web-apps






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 31 '18 at 5:45







      Firoza Shaikh

















      asked Dec 23 '18 at 14:43









      Firoza ShaikhFiroza Shaikh

      12




      12
























          2 Answers
          2






          active

          oldest

          votes


















          0














          PWAs in iOS is not yet fully supported. It can only do as much as offline caching but that's it. Apple iOS's version of A2HS is still manual and most users don't even know that the feature existed.



          If you want to trigger that A2HS banner, you will need to do a custom JavaScript event and pop up a custom A2HS HTML banner to "guide" your users on how to add the site on their home screen.






          share|improve this answer































            -1














            You can use BeforeInstallPrompt for this. And warn user about adding new PWA.
            criteria for BeforeInstallPrompt include the following:




            • The web app is not already installed

            • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

            • Meets the Progressive Web App criteria






            share|improve this answer
























            • I already tried this but it didn't work for me. Could you please help me with the code.

              – Firoza Shaikh
              Dec 28 '18 at 9:34











            • Push to git and shoot the link.

              – Amit Gandole
              Dec 28 '18 at 16:32











            • Please check the above code I pasted.

              – Firoza Shaikh
              Dec 31 '18 at 5:45











            • Do I need to write anything else apart from the above code.

              – Firoza Shaikh
              Dec 31 '18 at 5:46











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53904525%2fpwa-in-ios-prevent-to-add-home-screen-multiple-time%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            PWAs in iOS is not yet fully supported. It can only do as much as offline caching but that's it. Apple iOS's version of A2HS is still manual and most users don't even know that the feature existed.



            If you want to trigger that A2HS banner, you will need to do a custom JavaScript event and pop up a custom A2HS HTML banner to "guide" your users on how to add the site on their home screen.






            share|improve this answer




























              0














              PWAs in iOS is not yet fully supported. It can only do as much as offline caching but that's it. Apple iOS's version of A2HS is still manual and most users don't even know that the feature existed.



              If you want to trigger that A2HS banner, you will need to do a custom JavaScript event and pop up a custom A2HS HTML banner to "guide" your users on how to add the site on their home screen.






              share|improve this answer


























                0












                0








                0







                PWAs in iOS is not yet fully supported. It can only do as much as offline caching but that's it. Apple iOS's version of A2HS is still manual and most users don't even know that the feature existed.



                If you want to trigger that A2HS banner, you will need to do a custom JavaScript event and pop up a custom A2HS HTML banner to "guide" your users on how to add the site on their home screen.






                share|improve this answer













                PWAs in iOS is not yet fully supported. It can only do as much as offline caching but that's it. Apple iOS's version of A2HS is still manual and most users don't even know that the feature existed.



                If you want to trigger that A2HS banner, you will need to do a custom JavaScript event and pop up a custom A2HS HTML banner to "guide" your users on how to add the site on their home screen.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 20 at 3:00









                oninrossoninross

                601113




                601113

























                    -1














                    You can use BeforeInstallPrompt for this. And warn user about adding new PWA.
                    criteria for BeforeInstallPrompt include the following:




                    • The web app is not already installed

                    • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

                    • Meets the Progressive Web App criteria






                    share|improve this answer
























                    • I already tried this but it didn't work for me. Could you please help me with the code.

                      – Firoza Shaikh
                      Dec 28 '18 at 9:34











                    • Push to git and shoot the link.

                      – Amit Gandole
                      Dec 28 '18 at 16:32











                    • Please check the above code I pasted.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:45











                    • Do I need to write anything else apart from the above code.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:46
















                    -1














                    You can use BeforeInstallPrompt for this. And warn user about adding new PWA.
                    criteria for BeforeInstallPrompt include the following:




                    • The web app is not already installed

                    • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

                    • Meets the Progressive Web App criteria






                    share|improve this answer
























                    • I already tried this but it didn't work for me. Could you please help me with the code.

                      – Firoza Shaikh
                      Dec 28 '18 at 9:34











                    • Push to git and shoot the link.

                      – Amit Gandole
                      Dec 28 '18 at 16:32











                    • Please check the above code I pasted.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:45











                    • Do I need to write anything else apart from the above code.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:46














                    -1












                    -1








                    -1







                    You can use BeforeInstallPrompt for this. And warn user about adding new PWA.
                    criteria for BeforeInstallPrompt include the following:




                    • The web app is not already installed

                    • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

                    • Meets the Progressive Web App criteria






                    share|improve this answer













                    You can use BeforeInstallPrompt for this. And warn user about adding new PWA.
                    criteria for BeforeInstallPrompt include the following:




                    • The web app is not already installed

                    • Meets a user engagement heuristic (currently, the user has interacted with the domain for at least 30 seconds)

                    • Meets the Progressive Web App criteria







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 28 '18 at 6:59









                    Amit GandoleAmit Gandole

                    707




                    707













                    • I already tried this but it didn't work for me. Could you please help me with the code.

                      – Firoza Shaikh
                      Dec 28 '18 at 9:34











                    • Push to git and shoot the link.

                      – Amit Gandole
                      Dec 28 '18 at 16:32











                    • Please check the above code I pasted.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:45











                    • Do I need to write anything else apart from the above code.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:46



















                    • I already tried this but it didn't work for me. Could you please help me with the code.

                      – Firoza Shaikh
                      Dec 28 '18 at 9:34











                    • Push to git and shoot the link.

                      – Amit Gandole
                      Dec 28 '18 at 16:32











                    • Please check the above code I pasted.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:45











                    • Do I need to write anything else apart from the above code.

                      – Firoza Shaikh
                      Dec 31 '18 at 5:46

















                    I already tried this but it didn't work for me. Could you please help me with the code.

                    – Firoza Shaikh
                    Dec 28 '18 at 9:34





                    I already tried this but it didn't work for me. Could you please help me with the code.

                    – Firoza Shaikh
                    Dec 28 '18 at 9:34













                    Push to git and shoot the link.

                    – Amit Gandole
                    Dec 28 '18 at 16:32





                    Push to git and shoot the link.

                    – Amit Gandole
                    Dec 28 '18 at 16:32













                    Please check the above code I pasted.

                    – Firoza Shaikh
                    Dec 31 '18 at 5:45





                    Please check the above code I pasted.

                    – Firoza Shaikh
                    Dec 31 '18 at 5:45













                    Do I need to write anything else apart from the above code.

                    – Firoza Shaikh
                    Dec 31 '18 at 5:46





                    Do I need to write anything else apart from the above code.

                    – Firoza Shaikh
                    Dec 31 '18 at 5:46


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53904525%2fpwa-in-ios-prevent-to-add-home-screen-multiple-time%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Liquibase includeAll doesn't find base path

                    How to use setInterval in EJS file?

                    Petrus Granier-Deferre