vendredi 26 novembre 2021

How to redirect the user to mobile app or web app?

I have a web and mobile app and I want to share a link to open the mobile application if the user has installed it. But if it doesn't have it installed, I need to open the web application.

My code is

<body>
  redirecting...
  <script>
    window.location = `mobile-app-test://...`;

    setTimeout(function() {
      window.location = `https://webapp.com`;
    }, 1000);
  </script>
</body>

So I activate my application's schema and after a second I open the web application. But the code is bad.

Is it possible for me to validate if I opened the mobile application successfully? So I don't always need to open the web application after a second.

I want to try to open the mobile application and in case of error (it doesn't have it installed) then I open the web application.

Thanks =)




Aucun commentaire:

Enregistrer un commentaire