0
votes

I would like to know how to disable the browser cache, using HTML5.

I found this useful post (How to control web page caching, across all browsers?), but it contains the info only for HTML4 or other languages.

In my web application I use Java (Spring Boot) and Thymeleaf to produce HTML5. I would like to understand what are the equivalent tags for HTML5, of the following HTML tags:

<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0" />

It's fine either through HTML5 tags, or even through a Java side solution.

2
Possible duplicate of How to prevent html5 page from caching?Wils

2 Answers

0
votes

In order to disable the browser cache with HTML5, you can act on the Spring Security configuration class, as in the example:

@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
...
@Override
protected void configure(final HttpSecurity http) {
   ...
   http.headers().cacheControl().disable();
}
0
votes

For disable the browser cache with HTML5 in response header you can view this post automatically add header to every response.

For application made in Spring annotation-based see https://stackoverflow.com/a/49431665/4939245