Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect browser width and height?

Status
Not open for further replies.

ChrisQuick

Programmer
Oct 4, 1999
144
US
I want to check the current width and heigth of the browser window and resize to fullscreen (if the user aggrees to it).

This works in NS, but not IE. Any ideas why?

Code:
<SCRIPT TYPE=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>
	function Maximum(){
		if (window.outerWidth != screen.width){
			if (confirm(&quot;Is it OK to resize this browser window to fullscreen?&quot;)){
				window.moveTo(0,0);
	 			window.resizeTo(screen.width,screen.height-25);
			}
		}
	}
</SCRIPT>
cquick@geotg.com
Geographic Information System (GIS), ASP, some Oracle
 
try this:

first, check, if it IS IE: if(document.all){

then, for msIE use

document.body.offsetWidth
document.body.offsetHeight

or

document.body.clientWidth
document.body.clientHeight


...hope it was halpfull...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top