this might sound weird but instead of adding additional files when the user is on IE 8 I want to remove a JS file that is normally loaded in all other browsers.
So again.
I have this in my in my head:
<script type="text/javascript" async src="my-script.js"></script>
And I want that script to work in all browsers except in IE (because it is not working, so I don’t want to load it).
I know the usual conditional tags like this
<!--[if lt IE 9]>
<![endif]-->
But I guess there is no way to use them the other way around so the only solution that comes to my mind is this …
<?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == FALSE) { ?>
<script type="text/javascript" async src="my-script.js"></script>
<?php } ?>
Is this the best solution for doing this? Moreover I’d actually need to test for all IE Versions below 9. So I don’t want the JS file to be loaded in IE8, IE7 and IE6.
Thank you in advance.
All but IE
Only IE 9 and higher
or
IE 9 and higher + other browsers
Theoretically, you can use the OR operator, but this is not supported with the NOT IE comment-style.
You can also use nested comments like this:
More information