<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bernie Yu &#187; HTML5</title>
	<atom:link href="http://bernieyu.com/tag/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://bernieyu.com</link>
	<description>复刻生活</description>
	<lastBuildDate>Tue, 17 May 2016 09:03:15 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Javascript检测浏览器及终端类型</title>
		<link>http://bernieyu.com/2015/04/javascript-detect-brower-type/</link>
		<comments>http://bernieyu.com/2015/04/javascript-detect-brower-type/#comments</comments>
		<pubDate>Thu, 09 Apr 2015 03:58:41 +0000</pubDate>
		<dc:creator><![CDATA[Bernie Yu]]></dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://bernieyu.com/?p=61</guid>
		<description><![CDATA[原文转自：http://caibaojian.com/browser-ios-or-android.html， ... <a class="more-link" href="http://bernieyu.com/2015/04/javascript-detect-brower-type/">　　>>阅读全文&#60;&#60;</a>]]></description>
				<content:encoded><![CDATA[<p>原文转自：<a href="http://caibaojian.com/browser-ios-or-android.html">http://caibaojian.com/browser-ios-or-android.html</a>，略有调整</p>
<p>通过判断浏览器的userAgent，用正则来判断是否是ios和Android客户端。代码如下：</p>
<pre>&lt;script type="text/javascript"&gt;
var u = navigator.userAgent, app = navigator.appVersion;
var isAndroid = u.indexOf('Android') &gt; -1 || u.indexOf('Linux') &gt; -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
alert('是否是Android：'+isAndroid);
alert('是否是iOS：'+isiOS);
&lt;/script&gt;</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>其他浏览器检查函数，提供更多的检查内容，你可以检查是否是移动端（Mobile）、ipad、iphone、微信、QQ等。</p>
<p>第一种：来自<a href="http://blog.baiwand.com/?post=176">http://blog.baiwand.com/?post=176</a></p>
<pre>&lt;script type="text/javascript"&gt;
//判断访问终端
var browser={
    versions:function(){
        var u = navigator.userAgent, app = navigator.appVersion;
        return {
            trident: u.indexOf('Trident') &gt; -1, //IE内核
            presto: u.indexOf('Presto') &gt; -1, //opera内核
            webKit: u.indexOf('AppleWebKit') &gt; -1, //苹果、谷歌内核
            gecko: u.indexOf('Gecko') &gt; -1 &amp;&amp; u.indexOf('KHTML') == -1,//火狐内核
            mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
            ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
            android: u.indexOf('Android') &gt; -1 || u.indexOf('Linux') &gt; -1, //android终端或者uc浏览器
            iPhone: u.indexOf('iPhone') &gt; -1 , //是否为iPhone或者QQHD浏览器
            iPad: u.indexOf('iPad') &gt; -1, //是否iPad
            webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
            weixin: u.indexOf('MicroMessenger') &gt; -1, //是否微信 （2015-01-22新增）
            qq: u.match(/\sQQ/i) == " qq" //是否QQ
        };
    }(),
    language:(navigator.browserLanguage || navigator.language).toLowerCase()
}
&lt;/script&gt;
</pre>
<p>使用方法：</p>
<pre>//判断是否IE内核
if(browser.versions.trident){ alert("is IE"); }
//判断是否webKit内核
if(browser.versions.webKit){ alert("is webKit"); }
//判断是否移动端
if(browser.versions.mobile||browser.versions.android||browser.versions.ios){ alert("移动端"); }</pre>
<p>检测浏览器语言</p>
<pre>currentLang = navigator.language;   //判断除IE外其他浏览器使用语言
if(!currentLang){//判断IE浏览器使用语言
    currentLang = navigator.browserLanguage;
}
alert(currentLang);</pre>
<p>第二种：来自<a href="http://www.fufuok.com/JS-iphone-android.html">http://www.fufuok.com/JS-iphone-android.html</a></p>
<pre>if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
    //alert(navigator.userAgent);  
    window.location.href ="iPhone.html";
} else if (/(Android)/i.test(navigator.userAgent)) {
    //alert(navigator.userAgent); 
    window.location.href ="Android.html";
} else {
    window.location.href ="pc.html";
};</pre>
]]></content:encoded>
			<wfw:commentRss>http://bernieyu.com/2015/04/javascript-detect-brower-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>检查浏览器是否支持html5视频</title>
		<link>http://bernieyu.com/2015/04/check-brower-support-html5-video/</link>
		<comments>http://bernieyu.com/2015/04/check-brower-support-html5-video/#comments</comments>
		<pubDate>Thu, 02 Apr 2015 02:47:01 +0000</pubDate>
		<dc:creator><![CDATA[Bernie Yu]]></dc:creator>
				<category><![CDATA[WEB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://bernieyu.com/?p=34</guid>
		<description><![CDATA[在http://www.w3school.com.cn/html5/html_5_video.asp的源码里摘 ... <a class="more-link" href="http://bernieyu.com/2015/04/check-brower-support-html5-video/">　　>>阅读全文&#60;&#60;</a>]]></description>
				<content:encoded><![CDATA[<p>在http://www.w3school.com.cn/html5/html_5_video.asp的源码里摘出来的。</p>
<pre> 
function checkVideo()
{
if(!!document.createElement('video').canPlayType)
  {
  var vidTest=document.createElement("video");
  oggTest=vidTest.canPlayType('video/ogg; codecs="theora, vorbis"');
  if (!oggTest)
    {
    h264Test=vidTest.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
    if (!h264Test)
      {
      document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."
      }
    else
      {
      if (h264Test=="probably")
        {
        document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";
        }
      else
        {
        document.getElementById("checkVideoResult").innerHTML="Well. Some support.";
        }
      }
    }
  else
    {
    if (oggTest=="probably")
      {
      document.getElementById("checkVideoResult").innerHTML="Yes! Full support!";
      }
    else
      {
      document.getElementById("checkVideoResult").innerHTML="Well. Some support.";
      }
    }
  }
else
  {
  document.getElementById("checkVideoResult").innerHTML="Sorry. No video support."
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bernieyu.com/2015/04/check-brower-support-html5-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
