Different javascript files for different browsers
I would like to have two separated Javascript files. One for IE and another one for all other browsers. How would I do that?
<!--[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>
<开发者_Go百科![endif]-->
<!--[if IE]>
<script type="text/javascript" src="js/ie.js"></script>
<![endif]-->
<!--[if !IE]>-->
<script type="text/javascript" src="js/all.js"></script>
<!--<![endif]-->
$.getScript("js/" + ($.browser.msie ? "ie.js" : "all.js"));
That should be all you need to do.
精彩评论