Javascript to detect mobile browser screen width?

前端 未结 5 640
执念已碎
执念已碎 2021-02-05 15:47

i used screen.width to get the width of the browser. it worked fine with iphone safari but didn\'t work in android phone(it showed 800 width for android browser).

Is the

5条回答
  •  天命终不由人
    2021-02-05 16:09

    Just read these two URLs. It should help you get what you need.

    http://www.quirksmode.org/blog/archives/2010/08/combining_media.html http://www.quirksmode.org/mobile/tableViewport.html

    FYI, the Android probably is 800px wide. See this article among others: Understanding Samsung Galaxy Tab screen density

    Edit: Oh, I think the other guy was righter than me that pointed to the Android bug.

提交回复
热议问题