Tuesday, May 13, 2025
HomeGolangHow does browser caching at the moment work? - Getting Assist

How does browser caching at the moment work? – Getting Assist


There are recordsdata in my web site (.css, .js, .html) which can be going to vary consistently however on the similar time there are numerous others (with the identical extensions talked about above) that may all the time be static so I wish to inform the browser which recordsdata it’s allowed to cache. How do I do it utilizing Go?

Then again, I learn that browsers all the time cache .html recordsdata, if that’s true, how the hell are dynamic web sites going to work? that might power to make use of a whole lot of javascript and wouldn’t enable using methods reminiscent of templates. It’s value mentioning that I learn such data in outdated posts and I couldn’t discover present data, however my intuition tells me that at the moment any browser caches .html recordsdata, am I proper?

Static pages are rendered as they’re by Go.
Static pages with dynamic knowledge the place the info is handed to the template to {{.}} and rendered by Go.
Absolutely dynamic pages is often constructed by Javascript and rendered by the browser.

And there are pages rendered in Go and elements of the content material is up to date utilizing Javascript and innerHTML.

That’s how I interpret it. However the time period “dynamic” is floating.



1 Like

That is my case, so ought to I fear in regards to the browser caching the .html?

Browser is caching the pages to boost the pace subsequent time you load the identical content material. What do you are worried about? Usually caching is an efficient factor. Therefore I exploit Cloudflare to extend the cache additional…

Cache is helpful however not if the content material adjustments on the server facet.

The cache will then all the time be old-fashioned.

For dynamic HTML content material, you sometimes generate or render HTML content material primarily based on consumer requests or enterprise logic. Within the instance, a easy dynamic HTML content material is generated immediately inside the request handler perform.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments