if (window.Worker) {
// サポートしている場合
}
else {
// サポートしていない場合
}
Detection Techniques
http://diveintohtml5.info/detect.html
if (window.Worker) {
// サポートしている場合
}
else {
// サポートしていない場合
}
// http モジュールのロード
var http = require('http');
// url モジュールのロード
var url = require('url');
// Server オブジェクトの作成
http.createServer(function(request, response){
var url_parts = url.parse(request.url, true);
// レスポンスとして 200、プレーンテキストを返します。
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('こんにちは '+ url_parts.query.name + ' さん' +'\n');
console.log(url_parts.query.name + 'からリクエスト');
}).listen(8080, 'localhost');
// サーバーはリクエストを待っていることを示すメッセージ
console.log('http://localhost:8080 でサーバー動作中');
// http module モジュールのロード
var http = require('http');
// Server オブジェクトの作成
http.createServer(function(request, response){
// レスポンスとして 200、プレーンテキストを返します。
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Node.js から Hello World! \n');
console.log('リクエストを受け付けました。');
}).listen(8080, 'localhost');
// サーバーはリクエストを待っていることを示すメッセージ
console.log('http://localhost:8080 でサーバー動作中');
C:\workspaces>node HelloWorld.js Server running at http://localhost:8080