IE Conditional operator: OR … if is greater than i

2019-01-25 06:46发布

问题:

I want to only include history and ajaxify if the browser is ie9 or greater, OR is not ie:

<!--[if gte IE 9]>
    <script type="text/javascript" src="assets/js/plugins/history.js"></script>
    <script type="text/javascript" src="assets/js/plugins/ajaxify.js"></script>
<![endif]-->

How can I use the OR operator to say this:

<!--[if gte IE 9 | !IE ]> ??

Thanks!

回答1:

This worked:

    <!--[if gte IE 9 | !IE ]><!-->
        <script type="text/javascript" src="assets/js/plugins/history.js"></script>
        <script type="text/javascript" src="assets/js/plugins/ajaxify.js"></script>
    <![endif]-->


回答2:

Yeah, the or operator is: |. You can check this link for further information on conditional comments.