Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Browser specific Conditionals assistence

    Not really sure where this would fall under categories, so ill try it here

    ok am i all familiar with the use of conditionals to fix rendering issues with all IE browsers. I am wondering if conditionals able to determine if it is IE and differentiate between versions, or is there conditionals to test for other specific browsers.

    for example lately i have been having issues with safari and would like to be able to use conditionals to write specific code for only safari or firefox.

    Are there conditionals to test for this or another way to test for the specific browser i am trying to affect without the use of lengthy javascript or php code.

    if anyone knows of any methods or what not pls let me know or direct me in the right direction

    peace
    Sticky

  • #2
    Regular Coder
    Join Date
    Jun 2007
    Posts
    145
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    a nice little non javascript example is this:

    <!--[If IE 7]>
    <stylesheet stuff etc etc etc load this that and next thing (html)
    <![endif]-->

    <!--[If lt IE 6]>
    <stylesheet stuff etc etc etc load this that and next thing (html)
    <![endif]-->

    This will only detect and be read by the different IE versions, so what i do is, the default above this is for mozilla etc - then if browser is IE, it readsd those comments and sorts the hacks accordingly!

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,607
    Thanks
    6
    Thanked 997 Times in 970 Posts
    Nope, conditional comments are a MS proprietary thing. After all, if you write semantic code there shouldn’t be any issues with Safari or Firefox. CSS support is very good and consistent as well… if you do it right, of course.

  • #4
    Regular Coder
    Join Date
    Jun 2007
    Posts
    145
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what im saying is - you can pretty much therefore make the defualt for safari mozilla etc other gecko based clients - and catch IE?

  • #5
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    So, the answer is 'no' there are not specific conditional comments to only apply to any other browsers. As Stephan says, if you build semantic and well thought out/utilised CSS and (X)HTML code then you shouldn't be having any problems with the compliant browsers... IE has a few problems with some things, but the others are fairly similar.

    If there is an issue with something not displaying in the right place try zeroing out your paddings and margins in the style sheet with * {margin: 0; padding: 0;}
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #6
    New Coder
    Join Date
    May 2007
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    well thats what i normally do. but all of a sudden safari wants to blow up everything i am doing. Not all compliant browsers are completely the same so there are some instances where a little tweaking is involved. I was just curious if there was an easy way of detecting this there fore i would not have to go through several rewrites of my styles until they displayed correctly in both mozilla and safari

  • #7
    Senior Coder ahallicks's Avatar
    Join Date
    May 2006
    Location
    Lancaster, UK
    Posts
    1,134
    Thanks
    1
    Thanked 57 Times in 55 Posts
    Post a link to your problem and we might be able to help you/see something that you may have missed
    "write it for FireFox then hack it for IE."
    Quote Originally Posted by Mhtml View Post
    Domains are like women - all the good ones are taken unless you want one from some foreign country.
    Reputation is your friend

    Development & SEO Tools

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by ahallicks View Post
    Post a link to your problem and we might be able to help you/see something that you may have missed
    While ahallicks is correct. You may have missed something simple, conditionals for other browsers do exist. They are called downlevel conditional comments.
    http://www.456bereastreet.com/archiv...onal_comments/
    Another good link here
    http://thomas.tanreisoftware.com/?p=11
    Last edited by _Aerospace_Eng_; 07-18-2007 at 06:35 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,607
    Thanks
    6
    Thanked 997 Times in 970 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Haven’t read the entire article but while MS’s conditional comments are exactly intended to do what they do the CSS hacks are what they are: Hacks that exploit browser shortcomings. And while conditional comments always follow their intended behavior those hacks are kind of unstable as future versions of browsers might support a rule that was used to target a single browser only, and thus render the page incorrectly.

    This downlevel conditional comment is also only made for IE, though, in this case saying “if not IE …”. The other browsers can only be tricked by closing the comment to read and parse what’s there while IE gets told to not parse it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •