Support » Plugin: WP Super Cache » Page caching per user-agent

  • Hello,

    I keep seeing the same problem with different themes and SuperCache and was wondering if there was a work-around. Basically ,several themes include stylesheets depending on the user-agent. Somewhere in the theme there will be a line like this:

    if($is_chrome || $is_safari) {
                wp_enqueue_style("webkit", QODE_ROOT . "/css/webkit_stylesheet.css");

    So if somebody accesses the site on chrome or safari, this stylesheet will be included on the page, and SuperCache will cache this page, and present this page to all browsers. This then causes inconsistencies on the page.

    ## Steps

    1. Clear the super cache
    2. Access a page using Safari
    3. Ensure the page comes back with the “<!– Dynamic page generated…” confirming the page was cached
    4. Access the page on FireFox, Chrome…
    5. Notice that the webkit/Safari stylesheet is included on the page and applied.
    6. ## Ideas/Suggestion

      Would it be possible to add an option to enable a “Per-Browser caching”? When enabled, SuperCache would take into account the user-agent and create a cache for this particular user-agent. When the same user-agent connects, the correct HTML is returned, ensuring that there are no incompatibilities with browser-specific CSS.

    • This topic was modified 2 years, 7 months ago by  mclaurent. Reason: Reformatting the code sample
  • The topic ‘Page caching per user-agent’ is closed to new replies.