HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 24th, 1999, 12:32 PM
Phil
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi,
Can someone tell me how to obtain the resolution of the client browser in javascript. I don't found this in the navigator object.

Regards

Reply With Quote
  #2  
Old June 29th, 1999, 09:55 AM
webcoder
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

Hi Phil,

You might be a little confused here - of course, I might be a little confused too?

The term 'Resolution' describes a monitor setting of the user's computer. It's not a browser setting and I don't think you can access that info. from JS or from the web browser.


------------------
Matthew J. Flynn
http://webcoder.net

Reply With Quote
  #3  
Old July 5th, 1999, 11:59 PM
WhiteNight
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
You can get the current Resoultion through JS
Here is how to do it

<SCRIPT LANGUAGE=javascript>var xy = navigator.appVersion;xz = xy.substring(0,4);document.write('<B> ',screen.width,' x ',screen.height,'</B>')</SCRIPT>

This will write it to the document.

------------------
L8Rz
WhiteKnight

Reply With Quote
  #4  
Old July 7th, 1999, 11:21 AM
Striker
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Here is the same thing, but it notifies the client if the resolution does not match the anticipated design resolution.

<head>
</script>
<script language="JavaScript1.2">
var winX = screen.width;
var winY = screen.height;

if (winX <= '640') {
newWindow = window.open('reswarning.htm', '', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="no",width=300,height=225');
}
</script>
</head>

In the reswarning.htm (pop-up window) file, you can also insert this piece of JavaScript code for additional enhancement.


<script language="JavaScript1.2">
var winX = screen.width;
var winY = screen.height;

document.write('Your screen resolution is ' + winX + ' x ' + winY + ', which is below the recommended size for this application. If possible, please reset your screen resolution to 800 x 600 or higher. Thank you!');
</script>

--Good Luck



------------------
Striker

Reply With Quote
  #5  
Old November 7th, 2012, 12:58 PM
wakerunner wakerunner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Posts: 68 wakerunner User rank is Private First Class (20 - 50 Reputation Level)wakerunner User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 12 h 49 m
Reputation Power: 5
The other replies are incorrect, the code they gave you will give you the screen resolution, not the browser width.

See the website:
http://www.w3schools.com/jsref/prop_win_innerheight.asp

Syntax

Get:
window.innerWidth
window.innerHeight

Set:
window.innerWidth=pixels
window.innerHeight=pixels

Reply With Quote
  #6  
Old November 7th, 2012, 02:14 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,835 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 22 h 40 sec
Reputation Power: 4192
This thread is also over 12 years old. Next time please check the last post date when you reply to a thread that you found from a search query.

Please do not post links to that site here. There are better resources elsewhere. I recommend you read this: W3Fools: A W3Schools Intervention
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #7  
Old November 7th, 2012, 02:53 PM
wakerunner wakerunner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Posts: 68 wakerunner User rank is Private First Class (20 - 50 Reputation Level)wakerunner User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 12 h 49 m
Reputation Power: 5
Sorry I know the posts were old, I was just hoping to help future searchers who come upon this topic like I did. W3schools was not even the first site I found the info on... but I closed out the original site and couldn't find it again, then when I searched W3 was the first one I found that had the same info.

The info on there is correct... it works anyway.

I see other help sites listed on the page about W3... I'll check them out.

Last edited by wakerunner : November 7th, 2012 at 02:59 PM.

Reply With Quote
  #8  
Old November 7th, 2012, 03:34 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,835 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 22 h 40 sec
Reputation Power: 4192
It's good to make sure correct information is posted, but there is so much information available on the web (and on these forums) that is now outdated or just plain incorrect from the beginning, that correcting things that are obviously old like this is often more trouble than it's worth.

Don't let the "W3" in the name confuse you! W3C and W3Schools are two completely separate organizations. "W3" is simply another way to write "WWW", which is short for "world wide web".

I'm not aware of a one-stop-shop like W3Schools, but there are many better references for individual (or smaller groups of) languages elsewhere.
For JavaScript and DOM, I mainly use MDN (Mozilla Developer Network) and MSDN (Microsoft Developer Network):
https://developer.mozilla.org/en-US/docs/JavaScript
https://developer.mozilla.org/en-US/docs/DOM
MSDN HTML and DHTML Reference
JScript (ECMAScript3)

For CSS, I mainly use the official specs (I'm not going to list all of the CSS3 modules, if you need help finding one, just ask) and SitePoint's CSS Reference:
http://www.w3.org/TR/CSS21/
http://www.w3.org/TR/css3-selectors/
http://www.w3.org/TR/css3-background/
http://www.w3.org/TR/css3-box/
http://www.w3.org/TR/css3-ui/
http://reference.sitepoint.com/css

For HTML (and XHTML), I use the official specs but SitePoint's HTML Reference is good too:
http://www.w3.org/TR/html401/
Working Draft of the HTML5 specifications
http://www.w3.org/TR/xhtml1/
http://reference.sitepoint.com/html

For PHP, I use the official manual: http://php.net/manual/en/

For MySQL, I generally use the official documentation: http://dev.mysql.com/doc/
Comments on this post
Winters agrees!

Reply With Quote
  #9  
Old November 7th, 2012, 04:27 PM
wakerunner wakerunner is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Posts: 68 wakerunner User rank is Private First Class (20 - 50 Reputation Level)wakerunner User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 12 h 49 m
Reputation Power: 5
Great! Thanks for all the info!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > How to obtain the current browser resolution

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap