views:

31

answers:

2

Hi, in this very simple example:

var sys = require("sys"),
    http = require("http");

http.createServer(function(request, response) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.end("Hello World!");
}).listen(8080);

sys.puts("Server running at http://localhost:8080/");

1.) What kind of information can I get from the client? like browser, screen resolution, etc?

2.) How can I send information from the client to server, like parameter?

thanks!

+2  A: 

Have you read the API docs? The req object is a http.ServerRequest object as documented there. It's HTTP, and such things like resolution are not part of the protocol. What you can get is a user-agent, and from there you might be able to retrieve more information using another service.

Remember that node.js is a standalone app - it's not running in a browser - it's an HTTP Server application that is running in a JS interpreter.

SB
+1  A: 

You can't get the screen resolution information, but you can get the user agent from Request Header "User-Agent"