0

I want to detect Internet Explorer version and change some css with if statement to debuging. and How to detect it in by using wordpress?

and how to code if(//IE version whatever){ //to code here}

any idea?

1 Answers1

1

I don't think you need to detect IE browser via wordpress, instead you can make use of conditional comments in your script. Which get executed only in IE. Using this you can have a separate CSS for IE browsers.

An example,

<!--[if IE 8]>
<p>Welcome to Internet Explorer 8.</p>
<![endif]-->
Praveen
  • 55,303
  • 33
  • 133
  • 164
  • 1
    Upvoted, but bear in mind that IE10 doesn't implement conditional comments (this may, or may not, be a problem since it's, allegedly, pretty good at implementing CSS). – David Thomas Dec 23 '13 at 20:22
  • Will this really works? :O –  Dec 23 '13 at 20:24
  • Its IE. Its still a problem. – Stephen Dec 23 '13 at 20:25
  • @Mr.beginner Yes I have used it, however as David Thomas mentioned [Conditional comments are no longer supported in IE10](http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx) – Praveen Dec 23 '13 at 20:25
  • what to code if IE 10 or greater than 10 ? –  Dec 23 '13 at 20:28
  • @Mr.beginner then you need to check this [answer](http://stackoverflow.com/a/13971998/1671639) incase if you're interested in `modernizr` then move on to feature detection. – Praveen Dec 23 '13 at 20:30
  • @DavidThomas Thanks for your comment I have add the link too, glad to receive an upvote especially from you – Praveen Dec 23 '13 at 20:33
  • after putting my this code `` the site is not loading completly. :( –  Dec 23 '13 at 21:04
  • @Mr.beginner This isn't what I told. Try my approach `` – Praveen Dec 23 '13 at 21:05
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/43786/discussion-between-mr-beginner-and-praveen-jeganathan) –  Dec 23 '13 at 21:07
  • You're very welcome. But why "especially from [me]"? I've got a pretty good rep, but ain't nothing special (I've just had a lot of free time to kill over the past couple years...) :) – David Thomas Dec 23 '13 at 23:49
  • @DavidThomas you're one among [my favorites](http://stackoverflow.com/users/1671639/praveen-jeganathan) who care to answer others. I used to add users to the list when I cross people like you. I haven't start to earn big, once I reach that level I will help out as you [mentioned](http://stackoverflow.com/users/82548/david-thomas) Thats why I mentioned you're special :) – Praveen Dec 24 '13 at 05:21