์›น์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ• ๋•Œ ์‚ฌ์šฉ์ž์˜ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋ฌด์—‡์ธ์ง€๋Š” ์ •๋ง ์ค‘์š”ํ•œ ์š”์†Œ์ด๋‹ค. ๋งŒ์•ฝ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ธŒ๋ผ์šฐ์ €์—์„œ ๋ชจ๋‘ ์ •์ƒ์ ์ธ ํ™”๋ฉด์„ ๋ณด์—ฌ์ฃผ๋ ค๋ฉด ์ •๋ง ๋งŽ์€ ๋…ธ๋ ฅ์„ ํ•ด์•ผํ•œ๋‹ค. ๋ธŒ๋ผ์šฐ์ €๋งˆ๋‹ค ํ™”๋ฉด์— ๋ณด์—ฌ์ง€๋Š” ๋ชจ์Šต์ด ๋‹ค๋ฅผ๋•Œ๊ฐ€ ๋งŽ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. 

์˜ค๋Š˜์€ ์‚ฌ์šฉ์ž์˜ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋ฌด์—‡์ธ์ง€๋ฅผ ๊ตฌ๋ถ„ํ•  ์ˆ˜ ์žˆ๊ฒŒํ•ด์ฃผ๋Š” Navigator ๊ฐ์ฒด์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ๋‹ค.


Navigator ์†์„ฑ

๋„ค๋น„๊ฒŒ์ดํ„ฐ ๊ฐ์ฒด์˜ ์†์„ฑ์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค. 

PropertyDescription
appCodeName๋ธŒ๋ผ์šฐ์ € ๊ณ ์œ ์˜ ์ฝ”๋“œ๋ช…์— ๋Œ€ํ•œ ์†์„ฑ์ด๋‹ค. ๋„ท์Šค์ผ€์ดํ”„๋Š” Netscape , ์ต์Šคํ”Œ๋กœ๋Ÿฌ๋Š” Microsoft Internet Explorer ๊ฐ’์„ ๊ฐ€์ง„๋‹ค.
appVersion๋ธŒ๋ผ์šฐ์ € ๋ฒ„์ „, ์–ธ์–ด, ํ˜ธํ™˜์„ฑ ๋“ฑ๋“ฑ์˜ ์ •๋ณด๋ฅผ ๊ฐ–๋Š” ์†์„ฑ์ด๋‹ค.
language๋„ท์Šค์ผ€์ดํ”„์—์„œ๋งŒ ์‚ฌ์šฉ๋˜๋Š” ์†์„ฑ์ด๋‹ค. ์–ธ์–ด์ฝ”๋“œ๋ฅผ ๋‘๊ฐœ์˜ ์ผ€๋ฆญํ„ฐ๋กœ ๊ฐ–๋Š”๋‹ค. ko, en ์ฒ˜๋Ÿผ ๋ง์ด๋‹ค.
mimTypes[]ํด๋ผ์ด์–ธํŠธ(๋ธŒ๋ผ์šฐ์ €)๊ฐ€ ์ง€์›ํ•˜๋Š” ๋ชจ๋“  MIME ํƒ€์ž…์„ ๊ฐ–๊ณ ์žˆ๋Š” ์†์„ฑ์ด๋‹ค.์—ญ์‹œ ๋„ท์Šค์ผ€์ดํ”„ ์ „์šฉ์ด๋‹ค.
platform[]๋ธŒ๋ผ์šฐ์ €์˜ ํ”Œ๋žซ์ข€ ์ •๋ณด๋ฅผ ๊ฐ–๋Š” ์†์„ฑ์ด๋‹ค."Win32" for 32-bit Windows operating systems
plugins[]๋ธŒ๋ผ์šฐ์ €์— ์„ค์น˜๋œ ๋ชจ๋“  ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ์ •๋ณด๋ฅผ ๊ฐ–๋Š” ์†์„ฑ์ด๋‹ค. ๋„ท์Šค์ผ€์ดํ”„ ์ „์šฉ์ด๋‹ค.
userAgent[]์ฝ”๋“œ๋ช…๊ณผ ๋ธŒ๋ผ์šฐ์ €์˜ ๋ฒ„์ „์„ ๊ฐ–๋Š” ์†์„ฑ์ด๋‹ค. ์„œ๋ฒ„์—์„œ ํด๋ผ์ด์–ธํŠธ๋ฅผ ๊ตฌ๋ถ„์ง“๊ธฐ์œ„ํ•ด ์‚ฌ์šฉ๋œ๋‹ค.

Navigator ๋ฉ”์†Œ๋“œ

๋‹ค์Œ์€ Navigator์— ํŠนํ™”๋œ ๋ฉ”์†Œ๋“œ๋“ค์ž…๋‹ˆ๋‹ค.

MethodDescription
javaEnabled()์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ํ™œ์„ฑํ™”๋œ ํด๋ผ์ด์–ธํŠธ์ธ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ €์—์„œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰์„ ๊ธˆ์ง€ํ–ˆ๋‹ค๋ฉด false๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
plugings.refresh์ด ๋ฉ”์†Œ๋“œ๋Š” ์ƒˆ๋กœ ์„ค์น˜๋œ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•˜๊ณ  ๋ชจ๋“  ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ชฉ๋ก์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. Netscape only.
preference(name,value)์„œ๋ช…๋œ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๋„ท์Šค์ผ€์ดํ”„์˜ ์†์„ฑ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๊ฑฐ๋‚˜ ์„ธํŒ…ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ๋ฉ”์†Œ๋“œ์ž…๋‹ˆ๋‹ค. ๋‘๋ฒˆ์งธ ์ธ์ž๊ฐ€ ์—†์œผ๋ฉด getter์˜ ์—ญํ• ์„ ํ•˜๊ณ  ๋‘๋ฒˆ์งธ ์ธ์ž๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด setter์˜ ๊ธฐ๋Šฅ์„ ํ•˜๊ฒŒ๋ฉ๋‹ˆ๋‹ค. Netscape only.
taintEnabled()๋ฐ์ดํƒ€ tainting ์˜ ํ™œ์„ฑํ™” ์—ฌ๋ถ€๋ฅผ ์ฐธ, ๊ฑฐ์ง“์œผ๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. 


๋ธŒ๋ผ์šฐ์ € ๊ตฌ๋ณ„ํ•˜๊ธฐ

์•„๋ž˜ ์†Œ์Šค๋ฅผ ๋ธŒ๋ผ์šฐ์ € ์ข…๋ฅ˜๋ณ„๋กœ ํ…Œ์ŠคํŠธํ•ด๋ณด์„ธ์š”. 

<html>
<head>
<title>Browser Detection Example</title>
</head>
<body>
<script type="text/javascript">
<!--
var userAgent   = navigator.userAgent;
var opera       = (userAgent.indexOf('Opera') != -1);
var ie          = (userAgent.indexOf('MSIE') != -1);
var gecko       = (userAgent.indexOf('Gecko') != -1);
var netscape    = (userAgent.indexOf('Mozilla') != -1);
var version     = navigator.appVersion;

if (opera){
  document.write("Opera based browser");
  // Keep your opera specific URL here.
}else if (gecko){
  document.write("Mozilla based browser");
  // Keep your gecko specific URL here.
}else if (ie){
  document.write("IE based browser");
  // Keep your IE specific URL here.
}else if (netscape){
  document.write("Netscape based browser");
  // Keep your Netscape specific URL here.
}else{
  document.write("Unknown browser");
}
// You can include version to along with any above condition.
document.write("<br /> Browser version info : " + version );
//-->
</script>
</body>
</html>

 

 

 

Reference : http://www.tutorialspoint.com/javascript/javascript_browsers_handling.htm