screen对象包含有关客户端显示屏幕的信息screen.availWidthscreen.availHeight // 获取客户端关于屏幕的信息 var screenWidth = window.screen.availWidth; //获取可视区域的width var viewWidth = document.body.clientWidth; console.log(screenWidth) console.log(viewWidth)