A project of node express and a json request from the foreground may not trigger if they go back to the page.

  node.js, question

Now I have requested a json in document ready. If the page is newly opened or refreshed, the desired data can be returned correctly. If the page is returned from another page, the cached data will be used directly. At present, the time-consuming method in url can be used to solve the problem, but it feels that there should be a more elegant method.

Update it

If I go back to this page from another page, I won’t request this json at all. I will directly use the cached data. For example, I will use this json to request to fetch an array with a length of 2 from the background to generate 2 nodes, and then delete one from the current page. This step is to delete the corresponding elements in the array in the background synchronously, and then jump to the next page. In this page, After modifying the array for background data operation, and then backing off, the performance on the page is neither the 2 nodes of the modified array nor the only node left when leaving the page at that time, but the 2 nodes retrieved through json when the page was originally generated, and no json request was generated, so the background cannot see the request.

For Express, disabling etag should prevent the server from returning to http 304 status.