반응형
<%@ page language="java" contentType="text/html; charset=EUC-KR"
 pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<script type="text/javascript">
 function getInternetExplorerVersion() {
  var rv = -1; // Return value assumes failure.  
 
  
  if (navigator.appName == 'Microsoft Internet Explorer') {
   var ua = navigator.userAgent;
   alert(ua); 
   var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
   if (re.exec(ua) != null)
    rv = parseFloat(RegExp.$1);
  }
  return rv;
 }
 function checkVersion() {
  var msg = "You're not using Windows Internet Explorer.";
  var ver = getInternetExplorerVersion();
  if (ver > -1) {
   if (ver >= 8.0)
    msg = "You're using a recent copy of Windows Internet Explorer.";
   else
    msg = "You should upgrade your copy of Windows Internet Explorer.";
  }
  alert(msg);
 }
 function IsIE8Browser() {
  var rv = -1;
  var ua = navigator.userAgent;
  var re = new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");
  if (re.exec(ua) != null) {
   rv = parseFloat(RegExp.$1);
  }
  alert(ua);
  alert(re);
  alert("re.exec(ua) : "+re.exec(ua));
  alert(rv);
  return (rv == 4);
 }
</script>
</head>
<body>
<input type="button" value="브라우저테스트1" onclick="checkVersion();">
<input type="button" value="브라우저테스트2" onclick="IsIE8Browser();">
</body>
</html>
Posted by 1010