开发者

Detect mobile phone by seeing if viewport is respected

Hi sorry if this is already asked. But I looked around quite a bit.

The methods I have found for detecting if a web user is using a mobile phone don't seem very nice. They are: look at the user agent string (hackish), look for a narrow width (but what's narrow?).

Is there a direct way to see if the browser supports the <meta viewport...> directive? I think that would be the best way. Because that's what we want... If the browser supports开发者_开发知识库 viewport (i.e. is mobile) use it. Otherwise not.


Try this one: http://detectmobilebrowser.com/

The meta viewport is seems to be implemented differently from the CSS attributes, so any solution involving reading the viewport width before specifying it may not be portable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜