简体   繁体   English

如何查找用户是否正在通过手机访问我的网站?

[英]How to find if a user is visiting my site from a mobile phone?

I would like to identify if a user visits my website using a mobile phone device (not Ipad or any tablets) or the opposite, if simply is using a desktop/tablet device. 我想确定用户是使用手机设备(而不是Ipad或任何平板电脑)访问我的网站,还是相反(如果只是使用台式机/平板电脑设备)。

My goal is to load different style.css because of the non responsiveness of my site. 由于我的网站没有响应,我的目标是加载不同的style.css。

I know how to make if statements for this in my PHP but I do not know how to do the identification part in PHP. 我知道如何在PHP中为此编写if语句,但是我不知道如何在PHP中进行标识。 Also, any solutions using javascript are acceptable. 另外,任何使用javascript的解决方案都是可以接受的。

For example, mobile phones I consider 例如,我认为的手机

Iphone (Safari, Chrome, Firefox)
Android  (Safari, Chrome, Firefox)
Windows Phone (IE mobile)

Thank you 谢谢

instead of php and jquery you probably want to explore the option of @media queries in CSS 而不是php和jquery,您可能想探索CSS中@media查询的选项

the following article explains the process of setting them up in your stylesheet Different Stylesheets for Differently Sized Browser Windows 下一篇文章说明了在样式表中设置它们的过程针对不同大小的浏览器Windows的不同样式表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM