作为网站开发者和站长,希望网站的访问用户都以极速模式打开网站,也是可以实现的,我们可以使用双核浏览器提供的meta标签去实现。
1.我们只需要在 标签后面添加一段代码即可,如下所示:
<meta name="renderer" content="webkit"/>
2.需要注意的是,这个meta并非所有环境都通用,为了兼容所有双核浏览器及所有运行环境,建议使用这段代码。
默认使用极速模式,作用于360浏览器、QQ浏览器等国产双核浏览器:
<meta name="renderer" content="webkit"/>
默认使用极速模式,作用于其他双核浏览器:
<meta name="force-rendering" content="webkit"/>
如果有安装 Google Chrome Frame 插件则默认使用Chromium内核(也就是极速模式内核),否则强制本机支持的最高版本IE内核,作用于IE浏览器:
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
以上代码已经令所有双核浏览器默认使用极速模式而非IE模式访问,剩下的IE用户也就寥寥无几了,以下代码将IE10及以下版本的用户跳转到IE浏览器升级页:
<script>/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/</script>
@cc_on 是 IE10 及更旧版IE特有的条件编译语句,因此可以用来判断是否除 IE11 的其他IE版本。
3.以下是一个完整的代码案例。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
<script>/*@cc_on window.location.href="http://support.dmeng.net/upgrade-your-browser.html?referrer="+encodeURIComponent(window.location.href); @*/</script>
<!-- 为了获得更好的解析效果,请把规定内核的meta标签放在其他meta标签前面。这里放其他meta标签。-->
<title>网页标题</title>
</head>
<body>
网页内容
</body>
</html>