faqts : Computers : Programming : Languages : JavaScript : Browser Settings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 15 people (93%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How can I alert someone if their browser window is too small to properly view a site?

Jan 23rd, 2002 02:31
Francesco Defazio, Graham Lawton,


You can control the dimension of a browser window in onLoad event of 
body, in this way:
function checkBrowserWindow(){
if(parseInt(document.body.clientWidth)<800 || parseInt
(document.body.clientHeight)<600)
alert('Your browser window is too small!');
}
you can recall this on a resize event of the screen
window.onresize = function (evt) {
	checkBrowserWindow();
	} 
if you want check the resolution of the client monitor the property are:
window.screen.width
window.screen.height
Bye
Francesco Defazio