Q
Q
qqqqqqqqqqqa2021-07-22 23:44:57
Backend
qqqqqqqqqqqa, 2021-07-22 23:44:57

How to force static files to be loaded into client browser cache?

I'm building my site using ejs , node js and ajax templating technologies to manipulate the files needed by the client and backand of the site, and I have the following problem: I would like the user to have a sufficiently long open window with my site and long inactivity on it (let's say he went off to have tea]) would automatically get the necessary static files, which would have to be stored in the browser cache for further use (until the session ends or would be stored forever (by convention)). This is so that in the future, when going to other pages of the site, the user would not have to wait for the download of files that could have downloaded earlier.

And one more thing: it would be much more resource-saving to store any static files ever downloaded in the browser's cache, is it necessary to monitor the status of the client's available memory for this?

Tell me, what technologies and tactics can be used to implement the solution to this problem and what problems may arise in the course of what is happening?

UPD: I'm new, sorry if I said something wrong]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2021-07-22
@SagePtr

How do you know that he needs these files? If he went to drink tea, he doesn’t need your tab in the background to download something and eat traffic, if he switched to another tab, then even more so.
In general, you can use ServiceWorker for smart caching

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question