js fallback control page refreshes data

    // determines whether the page needs to be refreshed 
    <Script> 
        window.addEventListener ( 'pageshow', function (Event) { 
            // pageshow page load references: cache is true, onload is to false 
            // if loading from the cache, then the direct refresh 
            if ( event.persisted) // ios effective, android and pc every time false 
            { 
                location.reload (); 
            } 
            the else except // ios 
            { 
                // need to refresh the page in the coming years is set to return to true 
                IF (sessionStorage. the getItem ( 'Refresh') === 'to true') 
          { location.reload (); } }
      sessionStorage.removeItem ( 'Refresh'); // be sure to clear, or else the wine has a cycle }); </script>

  

// 设置session    sessionStorage.setItem("refresh", "true"); 

Guess you like

Origin www.cnblogs.com/liuzheng0612/p/12076076.html