Ctrl + F5 in jquery to clear browser cache

17,459

I think the reload function can take an argument that forces full refresh. ie:

window.location.reload(true);

For reference: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

Share:
17,459
Bugfixer
Author by

Bugfixer

Mi nombre es Shakun chaudhary. Actualmente trabajo en Publicis Sapient como Ingeniero de Software. Codificación, ganar y vivir mi vida con alegría. "Reconoce tus fallas para que puedas superarlas". @Skype : techie.jaat #SOreadytohelp

Updated on June 11, 2022

Comments

  • Bugfixer
    Bugfixer almost 2 years

    How to deep refresh window in jquery like you press f5 twice.currently i m using this.

    <script>
    window.onload = function() {
    if(!window.location.hash) {
        window.location = window.location + '#loaded';
        window.location.reload();
    }
    }
    </script>
    

    Thanks ! and it should not take much time to refresh. my webpage is in php.

  • Davide Pizzolato
    Davide Pizzolato almost 2 years
    It only works in firefox
  • Giwan
    Giwan almost 2 years
    @professor-abronsius you might want to consider removing this answer. The linked documentation indicates that this only works in FF and is only because of a mistake. It should always be window.location.reload() without arguments.