0

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.

Mario Petrovic
  • 4,128
  • 5
  • 26
  • 43
Giampiero Poggi
  • 297
  • 1
  • 3
  • 10
  • 1
    Possible duplicate of [How to prevent html5 page from caching?](https://stackoverflow.com/questions/15228697/how-to-prevent-html5-page-from-caching) – Wils Mar 21 '18 at 08:43

2 Answers2

0

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();
}
Giampiero Poggi
  • 297
  • 1
  • 3
  • 10
0

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

Giampiero Poggi
  • 297
  • 1
  • 3
  • 10