I have 2 pages, when i go back from page-2 to index the content don't reload, and the functions don't work correctly.
in the index page:
window.onload = function() {
     document.querySelector('h2').innerText = Math.floor(Math.random() * 101);
 };
But when I go back from the page-2, the onload function dont work.
I know that i can use window.onpageshow for this work. But, isn't there any more automatic way to refresh the page when come back?
I tried use the meta tag <meta http-equiv="Cache-control" content="no-cache"> but don't work.
      window.onload = function(event) {
        document.querySelector('h2').innerText = Math.floor(Math.random() * 101);
       };
 
        function navigate(link) {
          window.location.href = 'page-2.html';
         
     }
        
      <h2></h2>
      <button onclick="navigate('page-2.html');">Page 2</button> 
    