如何仅为IE 8运行脚本 [英] how do I run a script only for IE 8
本文介绍了如何仅为IE 8运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个js文件,并且只有在浏览器是IE 8时才想运行一些代码。有没有办法可以做到这一点?
I have a js file and would like to run some code only if the browser is IE 8. Is there a way I can do this?
现在我只有这个,但它适用于所有浏览器:
Right now I only have this but it's for all ie browsers:
if ($.browser.msie) {
//do stuff for IE 8
}
推荐答案
好的人,我自己解决了这个问题:
Alright people, I solved it myself like this:
if ($.browser.msie && $.browser.version == 8) {
//my stuff
}
这篇关于如何仅为IE 8运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文