네이버에서는 검색이 어려운 블로그입니다. 구글검색을 이용해 주세요.
컴퓨터의 브라우저 종류 확인
http://www.useragentstring.com/pages/useragentstring.php
========================================================================================
http://stackoverflow.com/questions/10964966
var div = document.createElement("div");
div.innerHTML = "<!--[if lte IE 9]><i></i><![endif]-->";
var oldie = (div.getElementsByTagName("i").length == 1);//IE9 이하
========================================================================================
========================================================================================
http://stackoverflow.com/questions/9847580
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
var isChrome = !!window.chrome && !isOpera; // Chrome 1+
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
========================================================================================
PHP
https://github.com/cbschuld/Browser.php
<?
$agent = $_SERVER["HTTP_USER_AGENT"];
$msie = (strpos($agent, 'MSIE') || strpos($agent, 'Trident')) ? true : false;
if ($msie) {
print "MSIE".PHP_EOL;
} else {
print "not MSIE".PHP_EOL;
}
?>
========================================================================================
모바일 브라우저 종류 확인
Detect Mobile Browsers
Open source mobile phone detection
http://detectmobilebrowsers.com/
========================================================================================
참고
http://www.quirksmode.org/css/condcom.html
<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<![endif]-->
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<![endif]-->
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]-->
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<![endif]-->
<!--[if !IE]> -->
According to the conditional comment this is not IE 5-9<br />
<!-- <![endif]-->
========================================================================================
Javascript
// msie, firefox, safari, chrome
function isIE () {
var myNav = navigator.userAgent.toLowerCase();
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
}
if (!isIE()) {
}
PHP
http://echopx.com/notes/browser-detection-ie-firefox-safari-chrome
- <?php
- $msie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') ? true : false;
- $firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox') ? true : false;
- $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari') ? true : false;
- $chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome') ? true : false;
- ?>
- <?php
- //Firefox
- if ($firefox) {
- echo 'you are using Firefox!';
- echo '<br />';
- }
- // Safari or Chrome. Both use the same engine - webkit
- if ($safari || $chrome) {
- echo 'you are using a webkit powered browser';
- echo '<br />';
- }
- // IE
- if ($msie) {
- echo '<br>you are using Internet Explorer<br>';
- echo '<br />';
- }
- // Not IE and for all other browsers
- if (!$msie) {
- echo '<br>you are not using Internet Explorer<br>';
- echo '<br />';
- }
- // Add inline css
- if ($firefox) {
- echo '<style type="text/css">';
- echo '.mydiv {position:relative; width:100px; height:50px;}';
- echo '</style>';
- }
- ?>
'Web Source' 카테고리의 다른 글
Center a new popup window even on dualscreen with javascript (0) | 2014.10.06 |
---|---|
Get Cross Domain iFrame Content (0) | 2014.09.25 |
iFrame auto resizer (0) | 2014.09.04 |
Div Zoom iFrame (0) | 2014.09.03 |
javascript yesterday (0) | 2014.09.03 |