Screen Width Detection

A

ashore

Folks, I'm using the following three methods of obtaining visitor
screen width, but some are getting through my checks. Here's what I'm
using. What am I missing?

window.innerWidth;
document.documentElement.clientWidth;
document.body.clientWidth;

Thanks for any help.

AS
 
R

rf

Folks, I'm using the following three methods of obtaining visitor
screen width,

Here we go again. Did you not search the archive on this matter?

Probably not, most google gropers don't know how to use google search
anyway!
but some are getting through my checks. Here's what I'm
using. What am I missing?

Telling us why you need the "window width".
 
B

Bart Van der Donck

ashore said:
Folks, I'm using the following three methods of obtaining visitor
screen width, but some are getting through my checks.  Here's what I'm
using.  What am I missing?

        window.innerWidth;
        document.documentElement.clientWidth;
        document.body.clientWidth;

It's explained in FAQ 4.9.:

http://www.jibbering.com/faq/#FAQ4_9

Cheers,
 
A

ashore

... Telling us why you need the "window width".

1. I'm putting a map on the page, and the map has selectable dim's; I
want to control the page portion devoted to it.
2. I want to know the characteristics of the screens used by my
client base for page layout purposes.

AS
 
S

SAM

ashore a écrit :
1. I'm putting a map on the page, and the map has selectable dim's; I
want to control the page portion devoted to it.

Since user can resize the map, isn't it his problem to have then to
scroll the page ?

CSS are your friends

img.map { min-width: 150px; width: 200px; max-width: 70%; }

example :
<http://www.w3schools.com/css/tryit.asp?filename=trycss_dim_max-width_percent>


Perhaps could you try to detect dimensions of the body ?

document.body.offsetWidth
document.body.offsetHeight
2. I want to know the characteristics of the screens used by my
client base for page layout purposes.

Point 2 : never I open my applications in full screen
To detect the screen if of no use
except if you try to enlarge the browser's window
if you do so be sur I quit immediately your site.
 
S

SAM

ashore a écrit :
My constructs DO use those in the FAQ - that's where I got them - but
some visitors are coming through without any numbers.

?? what does that mean ? 'any numbers' ?

if any numbers map's sizes = (300, 155)

So my question
remains.

fix the size of your map with css using size in %

<img style="width: 65%" blah
 
A

ashore

Guys, yes, there are work-arounds. Thank you.

But are you saying that despite the FAQ on this point a browser may
return non-numeric values? (null or "")

AS
 
T

Thomas 'PointedEars' Lahn

ashore said:
Guys, yes, there are work-arounds. Thank you.

For what?
But are you saying that despite the FAQ on this point a browser may
return non-numeric values? (null or "")

As we are talking about host objects, all bets are off.

You want to quote properly next time you post here.


PointedEars
 
H

Henry

My constructs DO use those in the FAQ - that's where I got
them - but some visitors are coming through without any
numbers. So my question remains.

How have you verified that your problem does lie somewhere between
reading the values and the "coming through" (whatever that is supposed
to be)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top