AW: [Seaside] Browser Information
Damien Cassou
damien.cassou at laposte.net
Wed Aug 16 18:20:23 UTC 2006
Jason Johnson wrote:
> But since the web server is also a smalltalk object, he would have this
> information, right? Seems terribly inefficient to have to generate
> javascript to find out the browser when the smalltalk system already
> knows what it is talking to.
I'm not an expert, this is only what I think happens and you may want to
wait for a more precise answer.
- Theoretically, the webserver does not have to know the type of client
it talks to. The client ask for a page sending and url, and the
webserver answers a content. No need to know who is asking.
- In practice, here is what a navigator send to a webserver (extracted
from the variable request in HttpAdaptator>>beginConversation):
URL=/seaside/config; protocol=HTTP/1.1;
'accept'->'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
'accept-charset'->'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
'accept-encoding'->'gzip,deflate'
'accept-language'->'fr-fr,en-gb;q=0.7,en;q=0.3'
'connection'->'keep-alive' 'host'->'localhost:8080' 'keep-alive'->'300'
'user-agent'->'Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.0.5)
Gecko/20060731 Ubuntu/dapper-security Firefox/1.5.0.5'
What is important for us is the last two lines. You can see that the
user-agent is filled with information about the version, the operating
system and other things like this. This information can easily be used
in your application.
But the question of Ramon wasn't about browser but about screen
resolution. As you can see, this information is not in the request. The
webserver doesn't know it and your application can't know it too...
unless the browser sends it. And that is the solution I proposed when I
say to send it using javascript. I think javascript can access this
information. With the information on the client side, you need to send
it to the webserver and then, you will be able to access it from your
component.
Hope it is clearer now
--
Damien Cassou
More information about the Seaside
mailing list