0

I want to load these scripts only in IE. The conditional comments aren't working because they aren't supported on IE 10 or above and I'm working on IE11.

¿Any ideas?

I tried the answer of this question, but it's giving me an error.

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>
IXTR Unai
  • 377
  • 2
  • 17
  • Do you have a server side language? it can usually pick up what browser you are using, otherwise you can use js to detect and include the scripts – Pete May 31 '17 at 10:35
  • https://stackoverflow.com/questions/29987969/how-to-load-a-script-only-in-ie – Alive to die - Anant May 31 '17 at 10:36
  • I tried the answer from the duplicated question before but It's giving me an error, that's why I did this question again Active Server Pages error 'ASP 0138' Nested Script Block /solicitudviajes/desplazamientos.asp, line 31 A script block cannot be placed inside another script block. – IXTR Unai May 31 '17 at 10:43
  • This is a problem with ASP not validating your document. You can probably get around that using the CDATA annotation. However, ASP is a different issue from what was asked here. – Hubert Grzeskowiak May 31 '17 at 14:10

1 Answers1

0

You need to identify the browser. There are some libraries out there which do this for you. A simpler approach would be using something like this:

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