How does js monitor the page and return to the current page through the return button to refresh the current page

how js detects the page and returns to the current page through the return button to refresh the current page

is not implemented through code by clicking the return button above the browser
if the test returns to the current page and wants to refresh the data of the form on the current page
history.back (- 1): directly return to the previous page of the current page, all the data messages, it is a new page
history.Go (- 1): it also returns the previous page of the current page, but all the data in the form is still in

.
Mar.23,2021

1, page a to page b, jump to
2 normally, check the return button on page b, and if you press the return button, save a tag for localstorage.
3. In the load function of page a, determine whether there is a tag in localstorage. If there is a tag, refresh it, and then delete the tag. If not, do not refresh

.

listen for return button code

 window.addEventListener('popstate', function (e) {
        // alert(''); // 
        //window.location.href = 'home.html';
        // history.go(0);
      }, false);
Menu