最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

css - JavaScript : How to get the window width and height? - Stack Overflow

programmeradmin1浏览0评论

I want to get the window height and width including Address bar , status bar,etc...

How can I get the window full height and width as shown in the picture below ?

Note : I know about the window.innerHeight and window.innerWidth . It does not suits for this scenario. window.innerHeight is used to get the DOM height only.outerWidth also does not gives what I have want.

Hope our stack users will give a good solution with cross browser compatibility.

I want to get the window height and width including Address bar , status bar,etc...

How can I get the window full height and width as shown in the picture below ?

Note : I know about the window.innerHeight and window.innerWidth . It does not suits for this scenario. window.innerHeight is used to get the DOM height only.outerWidth also does not gives what I have want.

Hope our stack users will give a good solution with cross browser compatibility.

Share Improve this question edited Apr 8, 2014 at 6:43 Human Being asked Apr 8, 2014 at 6:38 Human BeingHuman Being 8,38728 gold badges97 silver badges140 bronze badges 1
  • Jquery can be a solution. Read this answer stackoverflow.com/questions/2596594/… – mirmdasif Commented Apr 8, 2014 at 6:47
Add a comment  | 

2 Answers 2

Reset to default 17

use this if you want without scrollbars etc.. :

window.innerHeight; // for height

window.innerWidth; // for width

else in your case, if you want it full, use the below.

window.outerHeight; // for height

window.outerWidth; // for width

How about using jQuery Fiddle

$(window).width();

$(window).height();

Source jQuery Window Width

发布评论

评论列表(0)

  1. 暂无评论