What's Up With Conditional Comments for IE?

Discussion in 'HTML' started by vunet, Oct 16, 2008.

  1. vunet

    vunet Guest

    I am investigating positive and negative sides of using conditional
    comments:

    <!--[if IE 6]>
    @import url(/ie6.css);
    <![endif]-->

    My goal is to learn if JavaScript may handle it better or worse when
    parsing the page. For example, is it fine to write what's above as:

    if(ie6==true){ document.write "<style type='text/css'>@import url(/
    ie6.css);</style>"; }
    //ignore syntax if errors are there, you get the idea

    Please let me hear some thoughts and feedback. Thank you.
     
    vunet, Oct 16, 2008
    #1
    1. Advertising

  2. vunet

    Chaddy2222 Guest

    On Oct 17, 1:47 am, vunet <> wrote:
    > I am investigating positive and negative sides of using conditional
    > comments:
    >
    > <!--[if IE 6]>
    > @import url(/ie6.css);
    > <![endif]-->
    >
    > My goal is to learn if JavaScript may handle it better or worse when
    > parsing the page. For example, is it fine to write what's above as:
    >
    > if(ie6==true){ document.write "<style type='text/css'>@import url(/
    > ie6.css);</style>"; }
    > //ignore syntax if errors are there, you get the idea
    >
    > Please let me hear some thoughts and feedback. Thank you.

    The correct way to do it is with conditional comments.
    If you use that method all other browsers will just ignore them.
    But if you use JS things can get a bit messy.
    --
    Regards Chad. http://freewebdesignonline.org
     
    Chaddy2222, Oct 16, 2008
    #2
    1. Advertising

  3. vunet

    vunet Guest


    > The correct way to do it is with conditional comments.
    > If you use that method all other browsers will just ignore them.
    > But if you use JS things can get a bit messy.
    > --
    > Regards Chad.http://freewebdesignonline.org


    Can you provide more details about what you call "a bit messy"? I
    really want to know what may happen.
     
    vunet, Oct 16, 2008
    #3
  4. vunet wrote:
    >> The correct way to do it is with conditional comments.
    >> If you use that method all other browsers will just ignore them.
    >> But if you use JS things can get a bit messy.
    >> --
    >> Regards Chad.http://freewebdesignonline.org

    >
    > Can you provide more details about what you call "a bit messy"? I
    > really want to know what may happen.


    *Would* you rather write large chunks of your HTML page with
    document.write instead of just typing in the HTML directly? *Would* you
    prefer to write your own functions to determine which browser is in use?
    I'm not seeing what you think the advantage would be.
     
    Harlan Messinger, Oct 16, 2008
    #4
  5. vunet

    vunet Guest


    > *Would* you rather write large chunks of your HTML page with
    > document.write instead of just typing in the HTML directly?


    There might be cases when it is good to do so. Otherwise, it would
    never be done on practice.

    *Would* you
    > prefer to write your own functions to determine which browser is in use?


    Possibly yes. Is it a lot if you know what you are doing?

    > I'm not seeing what you think the advantage would be.


    I am looking for disadvantages more than advantages of including files
    dynamically. Say, scriptaculous.js uses document.write to include all
    user-requested files keeping non-requested ones aside.
     
    vunet, Oct 16, 2008
    #5
  6. vunet wrote:
    >> *Would* you rather write large chunks of your HTML page with
    >> document.write instead of just typing in the HTML directly?

    >
    > There might be cases when it is good to do so. Otherwise, it would
    > never be done on practice.
    >
    > *Would* you
    >> prefer to write your own functions to determine which browser is in
    >> use?

    >
    > Possibly yes. Is it a lot if you know what you are doing?
    >

    It's hard for someone who doesn't understand what advantages you imagine
    to exist to tell you why they wouldn't be advantages or why the
    disadvantages would outweigh them.

    >> I'm not seeing what you think the advantage would be.

    >
    > I am looking for disadvantages more than advantages of including
    > files dynamically. Say, scriptaculous.js uses document.write to
    > include all user-requested files keeping non-requested ones aside.


    You would normally do that on the server, not on the client.
     
    Harlan Messinger, Oct 16, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Graham

    conditional comments

    David Graham, Jul 22, 2003, in forum: HTML
    Replies:
    3
    Views:
    740
    Brian
    Jul 22, 2003
  2. Replies:
    6
    Views:
    491
    Andy Dingley
    Dec 27, 2003
  3. e n | c k m a

    Quick Conditional Comments Question

    e n | c k m a, Jul 20, 2004, in forum: HTML
    Replies:
    8
    Views:
    419
    e n | c k m a
    Jul 20, 2004
  4. Alec S.
    Replies:
    10
    Views:
    10,168
    Alec S.
    Apr 16, 2005
  5. David Mark
    Replies:
    4
    Views:
    310
    David Mark
    May 13, 2010
Loading...

Share This Page