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

 

posted @ 2014-09-06 09:03  土豆哥  阅读(155)  评论(0编辑  收藏  举报