在javascript中如何检测客户端的浏览器和操作系统类型?

var resolution = "分辨率:" + window.screen.width + "*" + window.screen.height;,

var ua = window.navigator.userAgent