仅在IE上加载脚本

时间:2017-05-31 10:34:41

标签: javascript jquery internet-explorer

我想只在IE中加载这些脚本。条件注释无效,因为IE 10或更高版本上的they aren't supported并且我正在使用IE11。

¿任何想法?

我尝试了answer of this question,但它给了我一个错误。

Active Server Pages error 'ASP 0138' 

Nested Script Block 

/solicitudviajes/desplazamientos.asp, line 31 

A script block cannot be placed inside another script block. 




<script type="text/javascript">
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent)){
    document.write('<script src="../jquery-ui/jquery-1.10.2.js"><\/script>');
    document.write('<script src="../jquery-ui/ui/jquery.ui.core.js"><\/script>');
    document.write('<script src="../jquery-ui/ui/jquery.ui.widget.js"><\/script>');
    document.write('<script src="../jquery-ui/ui/jquery.ui.dialog.js"><\/script>');
    document.write('<script src="../jquery-ui/ui/jquery.ui.button.js"><\/script>');
    document.write('<script src="../jquery-ui/ui/jquery.ui.position.js"><\/script>');
    document.write('<script src="../jquery-ui/js/jquery-ui-1.10.4.custom.min.js');
}
</script>

1 个答案:

答案 0 :(得分:0)

您需要识别浏览器。有一些图书馆为你做这件事。一种更简单的方法是使用这样的东西:

How to detect Safari, Chrome, IE, Firefox and Opera browser?

相关问题