Support » Plugin: W3 Total Cache » Issues with IE11 and Caching

  • Resolved Bene

    (@bene-2)


    I don’t know why, but some pages of my website are not working using the Internet Explorer 11. Looking into the source code and comparing the working and non-working pages, it seems like an essential js file is not being loaded (it’s a polyfill which does serve as a fallback for the IE. It is working fine, until W3 is activated).

    I’ve enqueued the polyfill js file like this:

    function mysite_enqueue() {
        $ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8');
        if (preg_match('~MSIE|Internet Explorer~i', $ua) || (strpos($ua, 'Trident/7.0') !== false && strpos($ua, 'rv:11.0') !== false)) {
            wp_enqueue_script(
                'polyfill',
                get_stylesheet_directory_uri() . '/js/polyfill.min.js',
                array(), '1.0', true
            );
        }
    }
    add_action( 'wp_enqueue_scripts', 'mysite_enqueue' );

    Could this be the issue? After clicking “purge all caches”, the site is working for maybe like an hour. After that, it is broken again. Strangely some pages work and some not.

    My W3 Total Cache plugin settings are mostly default. JS minification is disabled.

    Thanks for any help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Marko Vasiljevic

    (@vmarko)

    Hello @-bene-

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Can you please share your website URL?
    Did this issue started to occur recently or is it there for some time now?
    Thank you!

    The issue appeared as soon I have installed W3 Total Cache the first time.
    Sorry but I can’t share the website URL.
    After removing the if condition for the script, everything is working fine. The downside is, that the script is now loading in all browsers.

    So I think the issue is, that W3 is messing up the if preg_match conditon. Any ideas how to fix this?

    Plugin Support Marko Vasiljevic

    (@vmarko)

    Hello @-bene-

    We are checking this and I’ll get back to you as soon as we investigate.
    Thanks!

    Plugin Support Marko Vasiljevic

    (@vmarko)

    Hello @-bene-

    This behavior is expected since you want to cache content so your code for UA check is not executed when data is taken from the cache.
    A possible solution is to use user agent groups in Performance>User Agent Groups to create a group and add an IE user agent to ensure that a unique cache is created for each user agent group.
    Thank you!

    I see, I will try this out, thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issues with IE11 and Caching’ is closed to new replies.