• Sabrina B.

    (@sabrinabmoreira)


    Hello
    I have a website in WP and I noticed that when logging in or logging out the page refreshes but it doesn’t register as the user has logged in/logged out, needing to refresh the page one more time for this to be displayed.
    I noticed that when disabling the cache in the dev tools (network tab) of the chrome browser this problem does not happen, so I believe it is something related to the browser cache.

    I already reset the htaccess updating the permalinks, updated the url in settings -> general and add in wp-config define(‘WP_CACHE’, false), define(‘WP_HOME’,”) and define(‘WP_SITEURL’,”);

    All without success.

    I’ve already disabled all plugins, updated the wp and theme but the problem continues, it only works if browser cache is not selected in dev tool.

    Would anyone know anything about it?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    WP normally goes through the login screen, which forces us to navigate elsewhere and thus get a fresh, un-cached page. There are a few ways to override this behavior so users are returned to where they were. Without knowing which way your site uses, I cannot give specific advice.

    The gist though is the redirect after logging in/out needs to be to a different URL than the current one, or else the browser will use the cached version. Note different URL, not necessarily different page. Something in the page’s URL needs to be different. The simplest is to add a different URL query string. Adding the current timestamp as a value for example.

    Search the ‘net for “cache busting” for more on this topic.

    Thread Starter Sabrina B.

    (@sabrinabmoreira)

    I tried your suggestion but I still with the problem.
    Can I avoid my wp to do a browser cache of js files?

    Moderator bcworkz

    (@bcworkz)

    WP does not influence whether JS files are cached or not. It doesn’t even normally manage caching of its own content (unless you’re logged in, when it tries to discourage caching). There may be page speed optimization plugins that encourage caching, but by default WP does very little in regard to caching.

    It’s not unusual for there to be caching directives in a site’s .htaccess file. If you find any, you could disable them by turning them into comments (add a # at the head of each line). There are several possible caching directives, here’s one example:
    ExpiresByType text/javascript "access plus 1 month"

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Browser cache error on Chrome and Firefox’ is closed to new replies.