I'm using an image carousel script that is quite heavy on the browser. It works great in Opera and Chrome, half decent in FF and absolutely breaks my balls in IE. So i'd like to give IE users an alternative of simple HTML without any action/JS.
The script doesn't use MT or jQuery and its like 380 lines of JS. Would it be possible to give IE users a plain HTML alternative?
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{
// what command can i use?
}
Internet ExplorerClick Tools > Internet Options. Click the Security tab > Custom Level. In the Scripting section, click Enable for Active Scripting. In the dialog box that displays, click Yes.
JavaScript is a programming language that can run inside nearly all modern web browsers.
As with most modern browsers, Internet Explorer supports JavaScript, which is enabled by default to allow users view dynamic interactions like display ads and animations on web pages.
To execute JavaScript in a browser you have two options — either put it inside a script element anywhere inside an HTML document, or put it inside an external JavaScript file (with a . js extension) and then reference that file inside the HTML document using an empty script element with a src attribute.
This article is quite explanatory: http://msdn.microsoft.com/en-us/library/ms537509%28v=vs.85%29.aspx.
If your JS is unobtrusive, you can just use:
<![if !IE]>
<script src...
<![endif]>
You can do something like this to include IE-specific javascript:
<!--[IF IE]>
<script type="text/javascript">
// IE stuff
</script>
<![endif]-->
For IE10+ standard conditions don't work cause of engine change or some another reasons, cause, you know, it's MSIE. But for IE10+ you need to run something like this in your scripts:
if (navigator.userAgent.match(/Trident\/7\./)) {
// do stuff for IE.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With