Jump to content

how to get user screen height


alex242

Recommended Posts

Yea, I saw that, but it says it's only supported by FireFox; but after you brought it up, I tested it (with the code bellow) and it seemed to work on both FireFox and Chrome, but not EE. Is there a workaround or am I doing something wrong?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><script type="text/javascript">var hi = window.innerHeightdocument.write( hi );</script></head><body></body></html>

Link to comment
Share on other sites

It does actually work in more browser, according to this:http://www.quirksmode.org/dom/w3c_cssom.htmlUnfortunately, I can't think of any good Internet Explorer alternatives.You might be able to get the width by getting the document.body.offsetWidth, and if you give the <html> and <body> elements 100% height in CSS, then document.body.offsetHeight might be able to tell you the height of the window space.I don't think screen.width and screen.height are what you want.

Link to comment
Share on other sites

Is this what you meant? It doesn't appear to be working... could you take a look at it?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><style type="text/css">html, body { height:100% }</style><script type="text/javascript">var hi = window.innerHeight;var bye = document.body.offsetHeight;document.write( hi );document.write( bye );</script></head><body></body></html>

Oh, and I did think of a good alternative, just it's not an easy one to implement: STOP USING INTERNET EXPLORER ALREADY! GOD ITS THE TWENTY FIRST CENTURY!!!!! STUPID PEOPLE!!! STUPID MICROSOFT!!! *wehw* sorry, been holding that up for a while.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...