473,834 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5754
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*@WINDOZEdig iserv.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.c om...
On Mon, 05 Apr 2004 14:57:55 GMT, the right honourable "Ian.H"
<ia*@WINDOZEdig iserv.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.c om...
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.c om...
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.c lientWidth;
var w = document.body.c lientHeight;

if(h > 800 && w > 600) {
location.replac e(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

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

Similar topics

48
8720
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 The ScreenplayCSS is flawed, for several reasons; -overuse of <div id= tags -doesn't scale screen resolutions (convert from px to in, pt ?) -no media="print" (how much coule be shared between "screen" & "print") -no automatic page breaks (with...
0
264
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" Response.AddHeader("content-disposition", "attachment; filename=Report.xls") After this code, i write all the response.write statements that generates the html table. The Excel Report is saved perfectly. The page does not output anything on the screen. No problem till here!
9
3418
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 future...) I have a client with a text based site (displays a lot of labour law) which is being read in a range of resolutions and he wants a rewrite as a long term solution to browser resolution compatibility. My thinking goes........
4
1853
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 same size regardless of the screen resolution. Now that's my problem. In a sense, they want it so that if the screen is 800x600 and the text would be 1" tall, and then they make the screen 1600*1200, they still want the
2
3859
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, then when it is brought to full size, the right edge goes off the edge of the screen. How can I code to adjust for this? If I code for checking for the left edge and the size and being a certain distance from the right edge of the screen, then...
5
6215
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 either resolution 800 X 600 or 1152 X 864 it takes up the entire explorer size. In screen resolution 800 X 600, if I insert a pictures of 24 X 24 pixel in the cells it takes up the entire cell size (ideally it should as the cell size is also 24 X...
5
9023
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 make sure your program uses these namespaces: using System;
3
1646
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 controls and they had to use scroll bars!! Potentially all applications will be used by a wide range of users with different settings; is there a preferred way to designing applications to meet the needs of all end users? For this application,...
10
44094
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 screen. I used to write code in Java a few years ago (2005), and you could stretch a form with the mouse and all the controls and fonts would resize to larger or smaller size. Does .Net framework 3.5 support this kind of functionality? Or -...
0
9800
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9651
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10802
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10516
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10557
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5630
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5802
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3987
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3085
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.