how to add specific javascript file just for IE

0 votes
asked Mar 11 by katib (115 points)

I want to add a javascript file ie-only.js just for IE. how to do that.

After a little search i am doing something like this and its not working

<!--[if IE]>
<script src="ie-only.min.js"></script>

Any help

1 Answer

0 votes
answered Mar 11 by anonymous

I have tested following snippet

<!--[if !IE]><!--><script src="ie-only.js"></script><!--<![endif]-->
<!--[if IE]><script src="non-ie-only.js"></script><![endif]-->