如果在IE9中查看,是否要替换脚本? [英] Replace script if viewed in IE9?

查看:82
本文介绍了如果在IE9中查看,是否要替换脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据用户浏览器运行不同的javascript有多容易?

How easy would it be to run a different javascript depending on the user browser?

例如,如果某人使用IE9访问该网站,我希望它运行与正常为Chrome用户运行的脚本不同的脚本.

For example if someone visits the site with IE9 I would like it to run a different script to the one it would run normally for Chrome users.

推荐答案

您可以使用条件注释为此:

<!--[if lte IE 6]>
    <script>alert('lte stands for less than or equal to')</script>
<![endif]-->

<!--[if lt IE 7]>
    <script>alert('lt stands for less than')</script>
<![endif]-->

<!--[if gte IE 9]>
    <script>alert('gte stands for greater than or equal to')</script>
<![endif]-->

这篇关于如果在IE9中查看,是否要替换脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆