Menu

Searching inside browser conditional comments

2011-01-10
2013-01-03
  • Jens Ebesen

    Jens Ebesen - 2011-01-10

    I have a situation where I need to find all link tags on a page in order to re-write the href. This gives me a problem in one particular case which is if the link is inside a browser conditional comment, e.g:

    <!--[if IE]>
         <link rel="stylesheet" type="text/css" href="../resources/templates/stylesheets/ie-only.css" />
    <![endif]-->
    

    In this case the link is not found.

    The only way I have been able to solve this is to find all comment blocks and then manually updating their content, but I was wondering if there was a smarter way to find such link tags.

     
  • Martin Jericho

    Martin Jericho - 2011-01-10

    Try this at the start of your program:

    MicrosoftConditionalCommentTagTypes.register();

    Cheers 
    Martin

     

Log in to post a comment.