asp.netinternet-explorerwebformsconditional-comments

IE conditional comments not working in aspx page


I want to use the IE conditional comments to load the Angular scripts based on the IE version. But the conditional comments are not working, it throws error as angular is undefined? can anyone help me with this? the IE conditional comments will not work inside <asp:content> tag?

<asp:Content ID="Content2" ContentPlaceHolderID="ScriptSection" runat="server">

    <!--[if lt IE 9]>
<script src='<%= Page.ResolveClientUrl("~/Scripts/angular-1.2.16.min.js")%>' type="text/javascript"></script>
<![endif]-->

    <!--[if gte IE 9]>
<script src='<%= Page.ResolveClientUrl("~/Scripts/angular.min.js")%>' type="text/javascript"></script>
<![endif]-->
</asp:Content>

Solution

  • <![if IE]>   
    <script src='<%= Page.ResolveClientUrl("~/Scripts/angular-1.2.16.min.js")%>' type="text/javascript"></script>
    <![endif]>
    
    <![if IE]>   
    <script src='<%= Page.ResolveClientUrl("~/Scripts/angular.min.js")%>' type="text/javascript"></script>
    <![endif]>