我这是进行判断浏览器

css判断ie版本才引用样式或css文件

<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以下版本可识别 <![endif]-->

或者这样,直接解决:

<!--判断IE浏览器版本-->
<script>
window.AESKey = '';
// 判断浏览器是否支持placeholder属性
function isSupportPlaceholder() {
var input = document.createElement('input');
return 'placeholder' in input;
};
(function() {
//判断是否是IE浏览器,包括Edge浏览器
function IEVersion() {
//取得浏览器的userAgent字符串
var userAgent = navigator.userAgent;
//判断是否IE浏览器
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
if (isIE) {
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
if (fIEVersion < 10 || !isSupportPlaceholder()) {
return true;
}
} else {
return false;
}
}
var tpl = [
'<div class="browser-tips" style="margin:0 auto;text-align: center;">',
'<img style="display: inline-block;margin:100px 0 20px 0;" src="error.png">',
'<p style="font-size: 20px;color:#000;line-height: 32px;">为了给您提供更优质的网页浏览体验,建议使用IE10及以上版本的浏览器</p>',
'<p style="font-size: 20px;color:#000;line-height: 32px;">对“本网站”进行访问,请升级或更换其他浏览器</p>',
'</div>'
].join(''); window.onload = function() {
if (IEVersion()) {
document.write(tpl);
}
};
window.siteName = "本网站好啊好啊";
})();
</script>

最新文章

  1. WCF : 修复 Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service 问题
  2. How Spring Boot Autoconfiguration Magic Works--转
  3. NSRect
  4. 回顾JDBC
  5. 查看linux虚拟机ssh服务是否开启
  6. ibatas的一些实例及解释
  7. JavaScript高级程序设计7.pdf
  8. Linux系统CentOS6.2版本号下安装JDK7具体过程
  9. SQL开发中容易忽视的一些小地方(六)
  10. Restaurant &amp; Cooking Starter Kit v1.2.1
  11. 如何编写更好的SQL查询:终极指南-第一部分
  12. link-cut-tree 简单介绍
  13. 如何写jquery插件
  14. mysql面试题目1
  15. 后端自测必备神器-PostMan
  16. json 与 string 互转
  17. [LeetCode] Level Order Traversal
  18. (C#) 多线程访问int, bool 等值类型变量
  19. An In-Depth Look at the HBase Architecture--转载
  20. 利用gcc的__attribute__编译属性section子项构建初始化函数表【转】

热门文章

  1. SpringMVC学习07(Ajax)
  2. docker-01
  3. awk-07-IO和printf语句
  4. RabbitMQ 的使用
  5. C#串口通信SeriPort 电表DLT645 RS234/RS485
  6. jsoup的Document类
  7. The Programmer's Oath程序员的誓言----鲍勃·马丁大叔(Bob Martin)
  8. SqlServer 数据库备份到服务器,及删除
  9. 【转】时冲的CSDN:Linux系统各个目录的作用
  10. Springboot 日志、配置文件、接口数据如何脱敏?老鸟们都是这样玩的!