473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Finding browser screen width

What is best way to find browser screen width using javascript that is
compatible with all types of browsers.
Jul 23 '05 #1
6 5493
In article <76**************************@posting.google.com >,
ma*********@hotmail.com enlightened us with...
What is best way to find browser screen width using javascript that is
compatible with all types of browsers.


There is no one way that works with all browsers. You have to putz around
with the different methods. It's in the archives here - this question gets
posed rather frequently. Check google groups.

Why would you need it, anyway?
Good coding would have content fit readably no matter the width. The only
reason you might want it is to check stats or something. If you're trying to
resize content and whatnot, that's making a mountain out of a molehill. There
are way cleaner ways of getting your stuff to work in all browser windows.

--
--
~kaeli~
No one is listening until you make a mistake.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
kaeli wrote:
What is best way to find browser screen width
Why would you need it, anyway?
Good coding would have content fit readably no matter the width.


Well, I'm planning some photo gallery software which will use the window
size to select a default image size (which the user can override if they so
wish). So there are some reasonable uses for it :)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #3
In article <cm*******************@news.demon.co.uk>, do*****@yahoo.com
enlightened us with...
kaeli wrote:
What is best way to find browser screen width

Why would you need it, anyway?
Good coding would have content fit readably no matter the width.


Well, I'm planning some photo gallery software which will use the window
size to select a default image size (which the user can override if they so
wish). So there are some reasonable uses for it :)


Well, then, post your screen size detecting code for the OP. ;)

--
--
~kaeli~
Never say, "Oops!"; always say, "Ah, interesting!"
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4

"mgandra" <ma*********@hotmail.com> escreveu na mensagem
news:76**************************@posting.google.c om...
What is best way to find browser screen width using javascript that is
compatible with all types of browsers.


Javascript as a property that tell us the user screen resolution (not the
browser´s) If is that, you wish to acomplish just do as follow:
1 - create an input the HTML body
<body>
<input size="50" name="watheveryouwish">
<input type="button" value="Resolution" onclick="dofunction()">

2- create a script with function to capture screen resolution

<script type="text/javascript">

width=screen.width
height=screen.height

function dofunction()
{
watheveryouwish.value="You´re screen resolution is " +width+"*"+height
}

</script>

Jul 23 '05 #5
mgandra wrote:
What is best way to find browser screen width using javascript that is
compatible with all types of browsers.


The best way is to leave the browser window size the hell alone. It
isn't your browser and it isn't on your PC so stop trying to interfere
with what other people have chosen to do. Instead, use percentage sizes
for the components of your web page so that they fit into whatever space
the user chooses to let you use.
Jul 23 '05 #6
kaeli wrote:
Well, I'm planning
Well, then, post your screen size detecting code for the OP. ;)


I've got to write the indexing and scaling Perl first :)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: lawrence | last post by:
Under the domain publicpen.com I've several dozen sites in subdiretories, such as www.publicpen.com/honenbeger. I've no trouble with any of these sites. But under one, which I put in yesterday,...
3
by: anonieko | last post by:
You can try this code: > > > > > <!--- filename: mypage.html ----> <html> ....blah blah blah <script language=JavaScript src=/Javascript/center.js></script>
10
by: santiago538 | last post by:
Hi, Is there any way to specify which monitor a Window.open() will launch a new browser window in on systems with more than one display. It would only need to work with Mozilla browsers, and not...
10
by: tshad | last post by:
I have a Datagrid with a column: <asp:HyperLinkColumn DataTextField="JobTitle" DataNavigateUrlField="PositionID" DataNavigateUrlFormatString="AddNewPositions.aspx?PositionID={0}"...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
14
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
6
by: kklickman | last post by:
I've got a page with two columns: one floats left, the other doesn't float. The page displays fine in Netscape no matter what. In IE (both 6 and 7), it looks fine as long as the browser window is...
17
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I find the size of a browser window?...
246
by: Chris F.A. Johnson | last post by:
I have posted a quick survey at <http://cfaj.freeshell.org/testing/width.shtml>. There's only one question: select the widest line that fits in your normal browser window. Your assistance is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.