0

Browser detection error

Hello, I have an issue concerning the Browser Detection Booleans. Sometimes, being in Chrome or Firefox, the page is served as being in IE, as in the attached image.

Can this be related to the fact that I have the W3 Total Cache installed and running? If it is, is there a way to prevent this plugin from doing so?

Thanks.

  • 1
    If you have caching enabled then the HTML is saved from a previous visit. That's what caching is. You need caching for acceptable performance, which is why trying to use the user agent to add HTML classes for each browser is not a good idea. The fact that $is_macIE is in there shows how dated this practice is, and it's telling that WordPress itself does not use these variables for anything. There are far better ways to deal with browser compatibility than a body class. – Jacob Peattie Sep 4 at 10:51
  • Okay, thank you Jacob, any hint where to start? – Marc Sep 4 at 11:23
  • No. I don’t even know what particular problem you’re trying to solve. – Jacob Peattie Sep 4 at 14:29
  • I would like to detect the visitor's browser in wordpress even when using caché. – Marc Sep 4 at 14:50
  • So you’re ignoring the rest of my comment? You almost certainly don’t need a class for the user’s browser. What problem are you trying to solve by adding this class? – Jacob Peattie Sep 4 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.