javascriptreal-timenode.js

How to get information about the client in node.js


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!


Solution

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