10/24: JS(JavaScript)で取得できるクライアント情報
Category: Web dev
Posted by: hajime osako
JS(JavaScript)で取得できるクライアント情報、そこからアクセス解析の仕組みを考えてみる
function functest() { var strwork; var jsDate; jsDate = new Date(); strwork = "JSDATE : " + jsDate.getFullYear() + "/" + jsDate.getMonth()+1 + "/" + jsDate.getDate() + " " + jsDate.getHours() + ":" + jsDate.getMinutes() + ":" + jsDate.getSeconds() + "\n"; strwork = strwork + "HOST : " + location.host + "\n"; strwork = strwork + "HOSTNAME : " + location.hostname + "\n"; strwork = strwork + "PORT : " + location.port + "\n"; strwork = strwork + "PROTOCOL : " + location.protocol + "\n"; strwork = strwork + "HASH : " + location.hash + "\n"; strwork = strwork + "SEARCH : " + location.search + "\n"; strwork = strwork + "REQUEST : " + location.pathname + "\n"; strwork = strwork + "CODE : " + navigator.appCodeName + "\n"; strwork = strwork + "BROWSER : " + navigator.appName + "\n"; strwork = strwork + "VERSION : " + navigator.appVersion + "\n"; strwork = strwork + "LANG : " + navigator.language + "\n"; strwork = strwork + "PLATFORM : " + navigator.platform + "\n"; strwork = strwork + "USERAGENT: " + navigator.userAgent + "\n"; strwork = strwork + "REFERER : " + document.referrer + "\n"; strwork = strwork + "DOMAIN : " + document.domain + "\n"; strwork = strwork + "SCREEN.W : " + screen.width + "\n"; strwork = strwork + "SCREEN.H : " + screen.height + "\n"; if (screen.colorDepth==8) { strwork = strwork + "SCREEN.COL: " + screen.colorDepth + "Bit\n"; } else { strwork = strwork + "SCREEN.COL: " + screen.colorDepth + "Bit\n"; } alert(strwork); }