473,412 Members | 2,027 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,412 software developers and data experts.

How to get at the clients' screen size ?

I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?
Or can it be done in only one PHP program ?
frgr
Erik
Jul 17 '05 #1
13 5699
On Mon, 05 Apr 2004 16:26:46 +0200, Erik wrote:
I want to write a Server Side PHP program that generates a HTML page
client side.

OK...

How would I get at the clients' screen size, before serving the
generated page ?

Wow! Umm.. silly question.. why on earth would you want to do this!?

Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?

If you _really_ want to do this.. yes.

Or can it be done in only one PHP program ?

No. As you stated in your first sentence, PHP is server-side and knows
nothing of the client's environment.

_IMO_ this is a complete waste of time, effort and resources.

What about if I visit? or Lynx users? neither would run any Javascript you
add thus defeating your idea before it's off the ground =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #2
On Mon, 05 Apr 2004 14:57:55 GMT, the right honourable "Ian.H"
<ia*@WINDOZEdigiserv.net> wrote:
On Mon, 05 Apr 2004 16:26:46 +0200, Erik wrote:
I want to write a Server Side PHP program that generates a HTML page
client side.

OK...

How would I get at the clients' screen size, before serving the
generated page ?

Wow! Umm.. silly question.. why on earth would you want to do this!?

To determin the exact layout, to determin the screen real estate
available to me to build the page....
Pages for a 640 screen would be different from a 1280 screen...


Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?

If you _really_ want to do this.. yes.

Or can it be done in only one PHP program ?

No. As you stated in your first sentence, PHP is server-side and knows
nothing of the client's environment.

_IMO_ this is a complete waste of time, effort and resources.

What about if I visit? or Lynx users? neither would run any Javascript you
add thus defeating your idea before it's off the ground =)


still: would be nice to have a few client parameters, before building
the page...
Seems I am stuck with the least common denominator... a 640x480 or
something like that screen.... or build by ratios...


Regards,

Ian


Jul 17 '05 #3

"Erik" <et57 at correos calor dot com> wrote in message
news:hl********************************@4ax.com...
On Mon, 05 Apr 2004 14:57:55 GMT, the right honourable "Ian.H"
<ia*@WINDOZEdigiserv.net> wrote:

<snip>
Wow! Umm.. silly question.. why on earth would you want to do this!?

To determin the exact layout, to determin the screen real estate
available to me to build the page....
Pages for a 640 screen would be different from a 1280 screen...

<snip>

Well, ugh. Make a layout that assumes nothing about the client and you won't
have to. Like most technical problems, this one stems from unwise design
choices. When the user resizes his browser window to look at something else
at the same time, are you going to regenerate the page for him?

Garp
Jul 17 '05 #4
More than 50% of peoples resolution are 1024/768 soo... You don;t need to
worry. Less than 10% is more than that, the rest is really 800x600.

- Hayden

"Erik" <et57 at correos calor dot com> wrote in message
news:94********************************@4ax.com...
I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?
Or can it be done in only one PHP program ?
frgr
Erik

Jul 17 '05 #5
Hayden Kirk wrote:
More than 50% of peoples resolution are 1024/768 soo... You don;t need to
worry. Less than 10% is more than that, the rest is really 800x600.


My User-Agent string is:
ELinks/0.9.1 (textmode; Linux 2.6.4-1-386 i686; 108x46)

Yes, I know I'm one of the very few people in the whole wide world
who are completely shut out of a rapidly growing list of sites.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #6
"Erik" <et57 at correos calor dot com> wrote in message
news:94********************************@4ax.com...
I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
You can't. Currently there's no mechanism for client capability discovery in
HTTP.
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?


That's probably the only way. What you would do is assume the smaller size,
then redirect to the same page with the dimension added to the URL when more
space is available. Don't use the screen size though, as you can't assume
that the user will have the browser window maximized. Use the dimension of
the browser client area instead:

var h = document.body.clientWidth;
var w = document.body.clientHeight;

if(h > 800 && w > 600) {
location.replace(location.href + '?height=' + w + '&width=' + h);
}

A more ideal solution would dynamically link in a CSS style-sheet for the
larger available area.
Jul 17 '05 #7
In article <94********************************@4ax.com>,
Erik <et57 at correos calor dot com> wrote:
I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?
Or can it be done in only one PHP program ?


Yes, run a page that has a javascript that just loads your php page if the
variables for the screens size exist, or have the user choose from a list of
predefined resolutions.

--
Sandman[.net]
Jul 17 '05 #8
Erik wrote:

To determin the exact layout, to determin the screen
real estate available to me to build the page...


Hey Erik: 1995 called, and they want their broken web design techniques
back.

Do yourself and anyone who look at your web site a favor, and read up on
the web standards, most of which date from the late 1990s (this, of
course, is 2004): http://webstandards.org/

bblackmoor
2004-04-06
Jul 17 '05 #9
Pedro Graca wrote:
Hayden Kirk wrote:
More than 50% of peoples resolution are 1024/768 soo... You don;t
need to worry.
I start worrying when my website gets crippled by incompetent, soi-
disant designers too enamoured with their treasured gimcracks to care
about end-users.
Less than 10% is more than that, the rest is really 800x600.

Really? Hasn't anyone told you that 97 % of statistics are made up?

As to webpage authoring, screen dimensions are irrelevant; browser
window dimensions are irrelevant; canvas dimensions are irrelevant.
If you disagree with any of that, would you say that my system's
volume is relevant? If not, why not?
My User-Agent string is:
ELinks/0.9.1 (textmode; Linux 2.6.4-1-386 i686; 108x46)
That's informative.

Unfortunately, ignorant designers being two a penny now, user-agents
have taken to working against the intention of RFC2616. As I'm sure
you'll know already, Pedro, the User-Agent header "contains
information about the user agent originating the request" (RFC2616,
sec. 14.43); it isn't supposed to contain information about other
user-agents; it definitely isn't supposed to contain misinformation.
But it's almost standard practice nowadays for browsers to identify
themselves as one another, and to give users a choice of user-agent
strings. One of my screenreaders identifies itself as Mozilla/4.0!
Yes, I know I'm one of the very few people in the whole wide world
who are completely shut out of a rapidly growing list of sites.


If by "very few" you mean "many" (or "relatively few"), then I
suppose I must agree. :-) One might understandably be surprised at
how easy it is to be excluded from websites rigged up by designers
who are long on complacency and short on sound advice.

http://www.google.com/search?q=%22yo...%20doesn%20%22

--
Jock
Jul 17 '05 #10
I noticed that Message-ID:
<MP************************@News.Individual.NET> from John Dunlop
contained the following:
If by "very few" you mean "many" (or "relatively few"), then I
suppose I must agree. :-) One might understandably be surprised at
how easy it is to be excluded from websites rigged up by designers
who are long on complacency and short on sound advice.

http://www.google.com/search?q=%22yo...%20doesn%20%22


The picture doesn't look quite so bad if you exclude frames
http://www.google.com/search?q=%22yo...oesn%22-frames

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #11
On Wed, 07 Apr 2004 08:43:33 +0100, John Dunlop wrote:

Unfortunately, ignorant designers being two a penny now

Typically windoze (l)users / deezyners and think that IE is the be all and
end all.

It must be horrible having tunnel vision.. blurry tunnel vision at that.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #12

"Erik" <et57 at correos calor dot com> wrote in message
news:94********************************@4ax.com...
I want to write a Server Side PHP program that generates a HTML page
client side.
How would I get at the clients' screen size, before serving the
generated page ?
Would it be a two-step process: first let the client execute a piece
of JavaScript to generate Height and Width, and then send those values
to the PHP server (FORM, PUT) ?
Or can it be done in only one PHP program ?
frgr
Erik


First, yes, but second, don't do it:
http://groups.google.com/groups?q=%2...4ax.com&rnum=1

Moral is, don't design your pages around the dimensions of the window that
called the page up. Just make it fit 800x600 if you have to assume a size (>
80% users), but better yet, make it fit ANY size with relative sizing. The
user can always scroll sideways (unless they use WebTV, but hey).

Garp
Jul 17 '05 #13
On Thu, 08 Apr 2004 16:16:21 +0000, Garp wrote:
[ snip ]
The user can always scroll sideways (unless they use WebTV, but hey).

And this is another of the most infamous pet hates!

Avoid the horizontal scroll bars like the plague =)

Your "relative size" statement was much better.. make it fit "any" browser
size.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #14

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

Similar topics

48
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html ...
0
by: Spacy | last post by:
I have 2 hyperlinks. On the click of first hyperlink, ExcelReport.aspx is executed which contains the code: Response.ContentType = "application/vnd.ms-excel"...
9
by: Les Juby | last post by:
I understand that there are several ways to effectively control the browser delivery of HTML to make the most effective use of the different screen resolutions today. (And in the foreseeable...
4
by: UJ | last post by:
I have a client who wants me to make a web page with a marquee on it. No problem. They want the text to be easily changeable. No problem. They want it so that the text will appear about the...
2
by: copyco | last post by:
Does anyone have any suggestions on this? I have a form that can be collapsed into a compact size and expanded back to full size. If the user moves the compact size of the form close to the edge,...
5
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in...
5
Atran
by: Atran | last post by:
Hello Everyone. In this article: You will know to capture the screen in 2 ways: 1)- Capture full screen. 2)- Capture region. Let's Begin: First make a new Windows Application project. And...
3
by: axapta | last post by:
I recently developed an application on my PC, which has quite a large screen and a high resolution. When it was deployed, clients who had a different configuration had problems with seeing all the...
10
by: =?Utf-8?B?UmljaA==?= | last post by:
A lot of users at my workplace use different screen resolutions, and I build apps to use 1680 x 1050 pixels res by default. But some users are using 800 x 600, and the apps are too large for their...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.