Home  >  Article  >  Web Front-end  >  How to implement the error page that pops up if the browser version is low_html/css_WEB-ITnose

How to implement the error page that pops up if the browser version is low_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:06:351060browse

像网易的云课堂那样浏览器低于某一版本就转到错误页面,用if lt IE 8之类的能实现么


回复讨论(解决方案)

js检测useragent来判断客户端浏览器版本

例如,检测IE

if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number if (ieversion>=9)  document.write("You're using IE9 or above") else if (ieversion>=8)  document.write("You're using IE8 or above") else if (ieversion>=7)  document.write("You're using IE7.x") else if (ieversion>=6)  document.write("You're using IE6.x") else if (ieversion>=5)  document.write("You're using IE5.x")}else document.write("n/a")

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn