Different javascript files for different browsers

I would like to have two separate Javascript files. One for IE and one for all other browsers. How can I do it?

<!--[if IE]> <script type="text/javascript" src="js/ie.js"></script> <![endif]--> <!--[if ALL OTHER BROWSERS THAN IE]> <script type="text/javascript" src="js/all.js"></script> <![endif]--> 
+4
source share
2 answers
 <!--[if IE]> <script type="text/javascript" src="js/ie.js"></script> <![endif]--> <!--[if !IE]>--> <script type="text/javascript" src="js/all.js"></script> <!--<![endif]--> 
+3
source
 $.getScript("js/" + ($.browser.msie ? "ie.js" : "all.js")); 

That should be all you need to do.

+1
source

Source: https://habr.com/ru/post/1344927/


All Articles