Refresh page and run function after – JavaScript
You need to call myFunction() when the page is loaded. window.onload = myFunction; If you only want to run it when the page is reloaded, not when it’s loaded for the first time, you could use sessionStorage to pass this information. window.onload = function() { var reloading = sessionStorage.getItem(“reloading”); if (reloading) { sessionStorage.removeItem(“reloading”); myFunction(); } … Read more