How to get screen resolution of visitor in javascript and/or php?

后端 未结 6 961
情话喂你
情话喂你 2020-12-09 14:11

I would like to know the screen resolution of a visitor visiting my page so I can properly make a jquery thickbox cover about 75% of their screen.

Solutions to the q

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 14:46

    you can try this Window dimensions Hack and it speaks to ALL Browsers alike. (including dumb IE6)

    var width = document.body.offsetWidth;
    var bodyHeight = document.body.scrollHeight;
    var height = (typeof window.innerHeight !== "undefined")? window.innerHeight :  (document.documentElement)? document.documentElement.clientHeight : document.body.clientHeight;
        height = (bodyHeight > height)? bodyHeight : height;
    

提交回复
热议问题