This is a discussion on get the information of the browser? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; how can i get informations of browsers like browser type, browser window size using the java script?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Get the Browser Window Size ----------------------------------- window.innerHeight / window.innerWidth - Works in Most browsers, Not in IE document.body.clientHeight / document.body.clientWidth - Works in Most browsers, Including IE document.documentElement.clientHeight / document.documentElement.clientWidth - Works in all DOM browsers, Including IE By using the above properties, The value given by the browsers depends on the document type declaration(DTD) triggers the browser's strict mode or quirks mode. So, you can use the following script to get the browser size Code: function getBrowserSize() {
var Width = 0, Height = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
Width = window.innerWidth;
Height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
Width = document.documentElement.clientWidth;
Height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
Width = document.body.clientWidth;
Height = document.body.clientHeight;
}
return {"width":Width,"height":Height}
}
__________________ Regards, VELHARI I am not totally useless. I can be used for a bad example |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Microsoft Information | Shanthi | Technology BUZZzzzzz | 5 | 03-21-2008 03:12 AM |
| Track User information | Jeyaseelansarc | PHP Programming | 9 | 08-06-2007 02:06 AM |
| Visitor's browser information | venkat_charya | PHP Programming | 2 | 07-19-2007 02:50 AM |
| Information on Password Cracking | vadivelanvaidyanathan | Software Testing | 0 | 03-29-2007 09:51 PM |
| Information and code samples | rgm5 | Ruby | 0 | 02-23-2007 05:51 AM |