font awesome icon is not appearing in IE 11, but showing in other browsers

前端 未结 16 1440
孤城傲影
孤城傲影 2020-12-01 06:40

I am new to font-awesome icons. I have one page in which there is a filter where user can search the data. I have added font awesome icon just before the search link (as per

16条回答
  •  佛祖请我去吃肉
    2020-12-01 07:23

    If you are using Spring MVC with Spring Security, Spring Security automatically adds no cache headers and so causes font-awesome to break on IE11.

    (https://docs.spring.io/spring-security/site/docs/current/reference/html/headers.html#headers-cache-control)

    I solved the issue by adding a ResourceHandler in my WebMvcConfiguration for font-awesome configured to allow the browser to cache the fonts.

    public class WebMvcConfiguration extends WebMvcConfigurerAdapter
    {
        @Override
        public void addResourceHandlers( ResourceHandlerRegistry registry )
        {
            registry.addResourceHandler("/assets/vendor/font-awesome/fonts/**")
                .addResourceLocations("/assets/vendor/font-awesome/fonts/")
                .setCachePeriod(31556926);        
        }
    }
    

提交回复
热议问题