0

Posting this question and answer since I kept finding old questions with answers that didn't work.

onload="location.reload(true);"
window.location.reload(true);

The above did not work for me when used in the html or javascript file. (using flask and current version of Chrome)

the 'true' value is supposed to reload from the server instead of memory cache. https://www.w3schools.com/jsref/met_loc_reload.asp https://developer.mozilla.org/en-US/docs/Web/API/Location/reload

I was still having to use cntrl-F5 or experienced a refresh loop.

CodingMatters
  • 1,275
  • 16
  • 26
  • When the answers to a question are inadequate, you should just post your answer to that question instead of making a duplicate. – John Montgomery Dec 30 '19 at 23:45
  • ok. my bad. should I delete my question now? my account is banned from asking questions and I'm trying to clean up my account. – CodingMatters Jul 03 '20 at 23:14
  • 1
    [You can't delete it because it has multiple answers](https://meta.stackexchange.com/questions/5221/how-does-deleting-work-what-can-cause-a-post-to-be-deleted-and-what-does-that/5222#5222), but it doesn't really matter since with a score of 0 it shouldn't be counting against you either. Most likely you have some already-deleted questions with a negative score that are causing that (that same link also shows you how to access your recently deleted questions). – John Montgomery Jul 06 '20 at 21:38
  • thanks. went through my account and undeleted some questions, then accepted the answers. I had a panic last week as my account was frozen from asking questions ('You have reached your question limit). Seems my questions don't have enough upvotes. idk what to do next. – CodingMatters Jul 10 '20 at 08:00

2 Answers2

1

this worked

<script type="text/javascript" language="javascript">
    var versionUpdate = (new Date()).getTime();
    console.log("versionUpdate=", versionUpdate)
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "blah-foo-bar.js?v=" + versionUpdate;
    document.body.appendChild(script);
</script>
CodingMatters
  • 1,275
  • 16
  • 26
0

How are you testing your solutions? if you have what you provided in the JS file it will reload immediately upon page load. You probably wouldn't see it. Have you tried wrapping your code in a setTimeout function or call within a click handler or other function call?

setTimeout(function() {
  // reload after 3s
  window.location.reload();
}3000);
Jason Y
  • 831
  • 5
  • 10