javascriptbrowser-detectionresponsivenessmi

How to detect if Xiaomi's Mi Browser using JS


How to check using javascript if the user visiting my website is doing so using Xiaomi's native - Mi Browser.


Solution

  • Look at the useragent

    At least now, end 2023 you will need to look at MiuiBrowser, not just " MI "

    console.log(navigator.userAgent.indexOf("XiaoMi/MiuiBrowser") != -1 ? "MI browser":"Not MI browser")

    This will show any browser on an MI phone

    console.log(navigator.userAgent.indexOf(" Mi ") != -1 ? "MI":"Not MI")