c# 浏览器区别

c#   浏览器区别

思路:浏览器本身独有的属性来区别:

 

1.window对象的属性来区别:           

window.attachEvent               IE
window.addEventListener       chrome
window.ActiveXObject;           IE

window.MessageEvent           Chrome 和 firefox
window.openDatabase           Safari

2.js来区别:

navigator.userAgent.indexOf("MSIE")>0      IE

navigator.userAgent.indexOf("chrome")>0   chrome

navigator.userAgent.indexOf("firefox")>0    firefox

 

document.getBoxObjectFor      firefox    Chrome无
document.all ;                          IE

 

原文地址:https://www.cnblogs.com/zlp520/p/3959126.html