简体   繁体   中英

IE7 conditional - remove script

all I simply want to do is; if the browser is less than internet explorer 8 find and remove $(document).foundation();

<!--[if IE 8]>
   //code here
<![endif]-->

Simply deleting a plugin like that, eg

<!--[if lt IE 8]><!-->
<script>
  delete $.fn.foundation;
</script>
<!--<![endif]-->

Will probably cause all sorts of problems and is generally a bad idea - see here for why .

Instead, just load the foundation() plugin/related scripts if the browser is IE8+ or a different browser:

<!--[if gte IE 8]><!-->
<script src="/js/foundation.min.js"></script>
// Other related scripts etc...
<!--<![endif]-->

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM