Cache html file on client

On some of my pages I have β€œtemplates”. For example, I may have a table, and I have a "template" for each row of the table

<div class="wholeRow"><div class="lefCol"><!-- some stuff will go here --></div>...

Then I use JS to populate this table. This is a little silly, although the user has to download this template every time they visit the page - I must be able to cache it.

I'm not sure how to cache it; the only thing I can think of is to put it in a static javascript file and wrap it all with help document.write, but that seems like, well, stupid. Does anyone have any other ideas?

+3
source share
1 answer

, , , Javascript. , .

, .

- ( ). , Javascript, :

  • Cookies
  • API HTML5 JS

, . Cookies, . , cookie, , . JS.

- <div> . > .

+1

Source: https://habr.com/ru/post/1767200/


All Articles