Notice
Recent Posts
Recent Comments
Link
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Archives
Today
Total
관리 메뉴

web sprit

[HTML] meta태그를 이용해 최신브라우저 보기 본문

웹1.0/HTML

[HTML] meta태그를 이용해 최신브라우저 보기

커드만 2016. 10. 5. 11:55

meta 태그를 이용하면 간단하게

사용자의 ie의 최신 브라우저로 보게 만드는 것이 가능합니다.


1
2
3
 
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 
cs


위의 content 값은 여러가지가 있습니다.

  • IE=5 ~ IE=11 : IE 버전에 맞게 설정하면 그에 따른 버전으로 렌더링 하게 됩니다. (IE=6 제외)
  • IE=edge : 최신모드로 지정된 DOCTYPE에 상관없이 IE8 이상 버전에서 항상 최신 표준모드로 렌더링 됩니다.


과거에는 content="IE=edge, chrome=1" 처럼 대체방법으로 크롬 프레임이라는 ActiveX를 설치하라는 것을 추천했는데 크롬 프레임의 개발 종류로 이제 더이상 추천하지 않습니다.



X-UA-Compatible 속성 값은 IE 에서만 작동하는 비표준 속성이기 때문에 W3C에서 제공하는 유효성 검사툴(Validator)에서는 오류로 판단합니다. 이 오류가 큰 문제가 되진 않지만 

굳이 모든 웹페이지에 해당 태그를 작성하지 않도록 웹서버에 설정을 권장합니다.


아래 구문은 httpd.conf 혹은 .htaccess 에 설정합니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
# ------------------------------------------------------------------------------
# | Better website experience                                                  |
# ------------------------------------------------------------------------------
 
# Force IE to render pages in the highest available mode in the various
# cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf.
 
<IfModule mod_headers.c>
    Header set X-UA-Compatible "IE=edge"
    # `mod_headers` can't match based on the content-type, however, we only
    # want to send this header for HTML pages and not for the other resources
    <FilesMatch "\.(appcache|crx|css|cur|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|opus|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
    Header unset X-UA-Compatible
    </FilesMatch>
</IfModule>
 
cs


참고 URL : http://webdir.tistory.com/38


Comments