What's the best way to detect whether the client is a tablet or a phone?

后端 未结 4 1775
有刺的猬
有刺的猬 2021-01-22 20:24

I am currently developing a client side application which will be designed for both, smartphones and tablets. Therefore it will get two different layout modes.

While th

4条回答
  •  醉酒成梦
    2021-01-22 20:49

    You could detect whether it is a phone using a http://detectmobilebrowser.com/ script. If not, you can assume it is a tablet (since, as you mentioned, desktop browsers are irrelevant for this app).

提交回复
热议问题