IT Community - Software Programming, Web Development and Technical Support

get the information of the browser?

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?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-25-2008, 04:39 AM
saravanan saravanan is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Posts: 180
saravanan is on a distinguished road
Default get the information of the browser?

how can i get informations of browsers like browser type, browser window size using the java script?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-15-2008, 05:03 AM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 66
velhari is on a distinguished road
Send a message via AIM to velhari
Thumbs up Re: get the information of the browser?

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 12:32 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0