The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Jquery Browser Detection

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #27234

    I was having a problem with chrome. A div tag was positioned incorrectly so I looked for a Jquery script that could detect individual browsers, which you would then be able to give separate stylesheets.

    I found this … hacks.aspx
    used it and it works more than perfectly.
    The script allows you to create css rules for basically any browser and I want to use this script, create 1 stylesheet called "browser.css" and then have a list such as:

    body.browserIE { background: #fff }
    body.browserIE ul.nav li a { margin: -20px 0 0 0}

    body.browserChrome { background: #000 }
    body.browserChrome ul.nav li a { margin: -70px 0 0 0}

    body.browserSafari { background: #ccc url(images/example.gif) repeat-x left top}

    My question is: Is it better to do this, or is it better/safer to stick to the <!–[if condition]> HTML <![endif]–>? I haven’t heard about this before, but it could very well be because I am still a noob :lol: It would be very convenient to have all of the browsers’ css rules in one file.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.