4

The year is 2022, and Chrome seems to have just decided programmers aren't allowed to hard refresh anymore haha? I keep meaning to actually make a feature request ticket on their repository, but regardless, I really could use some help with this.

All of the other threads with code solutions don't seem to do the same refresh as Shift-Ctrl-R. The CSS just refuses to pull with everything I've tried.

I can't be the only developer on the planet who needs to hard reload chrome for a requirement, so I had to come here and ask.

This is my current Frankensteined Javascript solution that is communicating with a proxy in Apache, and it will switch between our demo and production portal. Right now it works when going from New to Old, but it won't work for Old to New.

DevTracker.setCookie = function(){
    document.cookie="demoweb=false;path=/";
    console.log("setCookie called!");

    $.ajax({
      url: window.location.href,
      headers: {
         "Pragma": "no-cache",
         "Expires": -1,
         "Cache-Control": "no-cache"
      }
   }).done(function() {
      window.location.reload(true);
   });

   window.location = location.href + '?upd=' + 123456;

   var oAjax = new XMLHttpRequest;
   oAjax.open('get', '/');
   oAjax.setRequestHeader('Pragma', 'no-cache');
   oAjax.send();
   oAjax.onreadystatechange = function() {
      if (oAjax.readyState === 4) {
         self.location.reload();
      }
   }

Is there any 2022 code solutions that work? Not a browser menu or keyboard shortcut.

Powermaster Prime
  • 402
  • 1
  • 2
  • 16
  • If you want 2022 answers for an existing question, [offer a bounty](https://stackoverflow.com/help/bounty). Don't ask a duplicate. – Quentin Oct 10 '22 at 12:55

1 Answers1

0

Open the developer window by pressing the F12 key. Then right-click on the refresh button and click the option Empty Cache and Hard Reload

lizardkingLK
  • 25
  • 2
  • 8