且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在blazor服务器端应用程序中检测移动设备?

更新时间:2022-11-03 18:18:48

我确实找到了这篇文章,可以阅读Blazor中一个窗口的宽度和高度.看起来它使用了JS Interop.这样,您可以根据其分辨率的宽度确定用户是否正在使用手机.当然,这并不是100%完全的证明,因为桌面上的某人可以将其窗口大小调整为移动分辨率. https://blazor.tips/blazor-how-to-ready-window-dimensions/

I did find this article that will read you the width and height of a window in Blazor. Looks like it uses JS Interop. With that, you can determine if a user is using a mobile based on the width of their resolution. Of course, it's not 100% full proof as someone on a desktop can resize their window down to a mobile resolution. https://blazor.tips/blazor-how-to-ready-window-dimensions/