Javascript to detect mobile browser screen width?

前端 未结 5 535
执念已碎
执念已碎 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:31

    You may try this url for detect screen size and apply a CSS style

    or

    
    
    
    screen.height           shows the height of the screen
    screen.width            shows the width of the screen
    screen.availHeight  shows height but removes the interface height like taskbar, and browser menu etc.
    screen.availWidth   same as above,instead gives available width
    

提交回复
热议问题