IT Community - Software Programming, Web Development and Technical Support

How to detect UserInner browser?

This is a discussion on How to detect UserInner browser? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi, I have tried to detect a users inner browser window size but can't find one. What I need ...


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 09-28-2007, 12:38 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Question How to detect UserInner browser?

Hi,

I have tried to detect a users inner browser window size but can't find one. What I need is to obtain the available space within a browser excluding tollbars etc, just where the website is shown, and deliver content appropriately.

Any help would be very much appreciated.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-28-2007, 08:28 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: How to detect UserInner browser?

Hi Vinoth

Try the below code

var scrW = 0, scrH = 0, scrOfX = 0, scrOfY = 0;
if( typeof( window.innerWidth ) == 'number' )
{
scrW = window.innerWidth; scrH = window.innerHeight;
}
else
{
if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
{
scrW = document.documentElement.clientWidth; scrH = document.documentElement.clientHeight;
}
else
{
if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
scrW = document.body.clientWidth; scrH = document.body.clientHeight;
}
}
}
if( typeof( window.pageYOffset ) == 'number' )
{
scrOfY = pageYOffset; scrOfX = pageXOffset;
}
else
{
if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
{
scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
}
else
{
if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; }
}
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-29-2007, 01:48 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: How to detect UserInner browser?

thnx Mr.Senthil!

I will try that out.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-06-2007, 07:10 AM
mobilegeek mobilegeek is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 205
mobilegeek is on a distinguished road
Wink Re: How to detect UserInner browser?

Use as follows buddy,

Code:
<style type="text/css">
html, body { overflow: auto; }
</style>

<script type="text/javascript">
function getWinSize() {
var  winWidth = 0, winHeight = 0, d = document;
if (typeof (window.innerHeight) == 'number') {
     winWidth = window.innerWidth;
     winHeight = window.innerHeight;
} else {
   if (d.documentElement && d.documentElement.clientHeight) {
        winWidth = d.documentElement.clientWidth;
        winHeight = d.documentElement.clientHeight;
} else {
       if (d.body && d.body.clientHeight) {
            winWidth = d.body.clientWidth;
            winHeight = d.body.clientHeight;
       }
}
}
document.getElementById('win').innerHTML = winWidth + ' x ' + winHeight;
}
window.onresize = getWinSize;
</script>

<div id="win"></div>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-07-2007, 10:31 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: How to detect UserInner browser?

function pageWidth()
{
return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
}
function pageHeight()
{
return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.bod y != null? document.body.clientHeight:null;
}
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
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
How to detect a CD Drive in C#? oxygen C# Programming 1 10-27-2007 05:00 AM
How would you detect and minimize memory leaks in Java? oxygen Java Programming 1 07-26-2007 05:01 AM
How would you detect and minimize memory leaks in Java? H2o Java Programming 1 07-24-2007 03:45 AM
How to detect collisions between 3D objects in Java ME (J2ME) M3G ? itbarota J2ME 1 07-19-2007 01:03 AM
How to detect collisions between 3D objects in Java ME (J2ME) M3G ? itbarota J2ME 0 07-17-2007 11:53 PM


All times are GMT -7. The time now is 11:56 AM.


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

SEO by vBSEO 3.0.0