如何在wordpress中检测Internet Explorer版本并使用if语句添加代码?

时间:2013-12-23 20:15:59

标签: javascript wordpress browser-detection

我想检测Internet Explorer版本并使用if语句更改一些css以进行debuging。 以及如何使用wordpress检测它?

以及如何编码if(//IE version whatever){ //to code here}

任何想法?

1 个答案:

答案 0 :(得分:1)

我认为您不需要通过wordpress检测IE浏览器,而是可以在脚本中使用conditional comments。哪个只在IE中执行。使用此功能,您可以为IE浏览器提供单独的CSS。

一个例子,

<!--[if IE 8]>
<p>Welcome to Internet Explorer 8.</p>
<![endif]-->