JavaScript: Detecting browser library function - does one exist? -
JavaScript: Detecting browser library function - does one exist? -
i looking write single, modern , up-to-date javascript function (or find one) - circa 2012 - reliably observe browsers. along lines of (pseudo-code):
function detectbrowser(){ if ie{ /* code observe ie version / quirks mode */ homecoming object containing ie version , boolean quirks mode? } else if webkit{ /* same thing. homecoming browser */ } else if gecko{ /* same thing. */ } }
anyone know of this? since know there people asking "why want this?", want such function can built atop of in different scenarios, such loading different style sheets based on browser.
if have alternative of using jquery, there jquery.browser
, has been deprecated , recommend using jquery.support
, has whole raft of properties tell browser or doesn't support. see: http://api.jquery.com/jquery.support/
for stylesheet rendering example, don't need utilize script, can accomplish within html using statements like:
<!--[if ie 6]> <link rel="stylesheet" type="text/css" href="ie6.css" /> <![endif]-->
javascript browser detect
Comments
Post a Comment