Merhaba arkadaşlar, bir çok yerde gördüm nasıl yapıldığını merak ediyorum

örnek; kaave.app/d/indir android cihazdan tıklanıldığında play store'a ios cihazdan tıklanıldığında ise apple markete yönleniyor.

Bunu nasıl yaparım?

Edit: Şu kod ile çalıştı arkadaşlar.

<script>
var userAgent = navigator.userAgent || navigator.vendor || window.opera;     // Huawei Phone must come first because its UA also contains "Android"    if (userAgent.includes("HUAWEI")) {       window.location.replace("https://appgallery.huawei.com/app/C101184875");    } else if (userAgent.includes("Android")) {        window.location.replace("https://play.google.com/store/apps/details?id=org.telegram.messenger&hl=en&gl=US");    } else if (userAgent.includes("iPhone")) {        window.location.replace("https://apps.apple.com/us/app/telegram-messenger/id686449807");    } else {        //cant be sure about device, so redirect to home page        window.location.replace("https://google.ro");    } </script>