C# .NET Checking if browser is mobile - what is the most reliable way?

后端 未结 5 1659
谎友^
谎友^ 2021-01-14 19:03

I know I can use Request.Browser.IsMobileDevice.

But does anyone know how it works, and if it is reliable and up to date?

Thanks!

5条回答
  •  星月不相逢
    2021-01-14 19:19

    This question needed some 2018 love. Try this.

    if(Request.Browser.IsMobileDevice){
    // do something
    }
    

    You shouldn't need any @using statements for this, but if you did Intellisense would you tell and help you add it with a click.

提交回复
热议问题