[Resolved] How to Detect Browser?

Home Forums Support [Resolved] How to Detect Browser?

Home Forums Support How to Detect Browser?

  • This topic has 3 replies, 2 voices, and was last updated 6 years ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #541784
    Vish

    Hello!

    I am using custom CSS to show the heading in a fancy way. But it turns out that the custom CSS does not work Internet Explorer (in some old versions).

    So, is there a way (PHP Code?) to detect the browser and not load that particular CSS (it is in the Additional CSS Section)?

    Thanks!

    #542212
    Tom
    Lead Developer
    Lead Developer

    You would have to use javascript. Here’s an example: https://gist.github.com/ccurtin/6fb05b7739e6e538e783

    Then you’d do this to your CSS:

    body:not(.IE) .your-selector {
    
    }
    #542290
    Vish

    Forgive my ignorance but, where should I put the JavaScript? Please help!

    #542620
    Tom
    Lead Developer
    Lead Developer

    You could put it in the wp_footer hook in GP Hooks, within these tags:

    <script>
        // JS in here
    </script>
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.