如何获得客户的屏幕尺寸? [英] How to get at the clients' screen size ?

查看:78
本文介绍了如何获得客户的屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个生成HTML页面的服务器端PHP程序

客户端。

如何在服务之前获得客户的屏幕尺寸

生成的页面?

这是一个两步的过程:首先让客户端执行一个

的JavaScript来生成高度和宽度,然后将这些值

发送到PHP服务器(FORM,PUT)?

或者只能在一个PHP程序中完成?

$ ggr

Erik

解决方案

2004年4月5日星期一16:26:46 + 0200,Erik写道:

我想编写一个服务器端PHP程序,它生成一个HTML页面
客户端。



OK ...


如何在服务
生成页面?



哇!嗯..愚蠢的问题..为什么你要这么做呢!?


这是一个两步的过程:首先让客户执行一件
用JavaScript生成高度和宽度,然后将这些值发送到PHP服务器(FORM,PUT)?



如果你_really_想要这样做..是的。


或者只能在一个PHP程序中完成?



否正如你在第一句话中所述,PHP是服务器端的,并且知道

没有客户的环境。


_IMO_这完全是浪费时间,精力和资源。


如果我去拜访怎么办?还是Lynx用户?既不会运行任何Javascript你

添加因此在它开始之前击败你的想法=)


问候,

Ian


-

Ian.H

digiServ网络

伦敦,英国
http://digiserv.net/


2004年4月5日星期一14:57:55 GMT,正确的光荣Ian.H

< ia * @WINDOZEdigiserv.net> ;写道:

2004年4月5日星期一16:26:46 +0200,Erik写道:

我想写一个服务器端生成HTML页面的PHP程序客户端。

好的......

我如何得到客户的' '屏幕大小,在提供
生成页面之前?



哇!嗯..愚蠢的问题..为什么你想要这样做??



确定确切的布局,确定屏幕房地产

我可以建立页面....

640屏幕的页面与1280屏幕不同...


它是一个两步过程:首先让客户端执行一段JavaScript来生成高度和宽度,然后将这些值发送到PHP服务器(FORM,PUT) ?

如果你_really_想要这样做..是的。

或者只能在一个PHP程序中完成?


编号正如你在第一句话中所述,PHP是服务器端的,并且对客户的环境一无所知。

_IMO_这是完全浪费时间,精力和资源。

如果我访问怎么样?还是Lynx用户?既不会运行你添加的任何Javascript,从而在它开始之前击败你的想法=)




仍然:很高兴有几个客户参数,在构建之前

页面...

似乎我被困在最小公分母......一个640x480或

的东西喜欢那个屏幕....或按照比例建立...


问候,

伊恩






" Erik" < et57 at correos calor dot com>在消息中写道

news:hl ******************************** @ 4ax.com ...

2004年4月5日星期一14:57:55 GMT,正确的光荣Ian.H
< ia * @ WINDOZEdigiserv.net>写道:



< snip>

哇!嗯..愚蠢的问题..为什么你想要这样做呢??



确定确切的布局,确定我可用的屏幕空间
构建页面....
640屏幕的页面将与1280屏幕不同...



< snip>


好​​吧,呃。制作一个不对客户做任何假设的布局,你就不会有b $ b b。像大多数技术问题一样,这个问题源于不明智的设计

选择。当用户调整浏览器窗口大小同时查看其他内容

时,您是否要为他重新生成页面?


Garp


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

解决方案

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/


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





"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


这篇关于如何获得客户的屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆