so 1 of scripts have in website mouse hover script changes color , image. not behaving in ie disable script if user using ie.
how can that?
example of want:
//if ie not detected(any other browser detected) <script type="text/javascript" src="js/mousehover.js"></script> //else (ie detected) //do nothing / don't upload script
it's better debug script, @ least ie8+.
if want avoid loading script on ie, though, believe it's browser activexobject
, simplest thing put guard around code in mousehover.js
:
if (typeof activexobject !== "undefined") { // ie, don't mouse hover stuff }
or if it's important not download js on ie, can in 2 ways:
<script> (function() { if (typeof activexobject === "undefined") { var s = document.createelement('script'); s.src = "js/mousehover.js"; document.documentelement.appendchild(s); } })(); </script>
that load script on non-ie. note subsequent scripts have not wait script load, if there dependencies, you'll need watch them.
or using document.write
:
<script> if (typeof activexobject === "undefined") { document.write('<scr' + 'ipt src="js/mousehover.js"></scr' + 'ipt>'); } </script>
...which maintain load order, can't used in xhtml.
Comments
Post a Comment