Angular:如何缓存图像? [英] Angular: How to cache images?

查看:173
本文介绍了Angular:如何缓存图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Web应用程序,我需要在该应用程序中缓存图像,以便在用户再次关闭并打开网站时不需要花费时间来加载。
通过再次打开网站,应该从缓存中加载图像,而不是再次重新加载。

I am developing a web app where I need to cache images so that it does not take time to load if user closes and opens website again. By opening website again, images should be loaded from cache instead of reloading again.

可以用Angular实现吗?

Is this possible to implement with Angular?

我在网上进行了很多搜索,但是还没有找到合适的解决方案。

I searched a lot online but I did not find proper solution for that yet.

推荐答案


您可以使用- HTML清单属性

清单属性指定

HTML5引入了应用程序缓存,这意味着Web应用程序被缓存了,并且可以在没有Internet连接的情况下访问。

HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection.

应用程序缓存为应用程序提供了三个优点:

Application cache gives an application three advantages:


  • 脱机浏览-用户可以在脱机时使用该应用程序
    速度-缓存的资源加载速度更快

  • 减少服务器负载-浏览器将仅从服务器下载更新/更改的资源

  • 清单属性应该

清单文件是一个简单的文本文件,其中列出了浏览器应缓存以供脱机访问。

The manifest file is a simple text file that lists the resources the browser should cache for offline access.

详细了解请阅读此博客: https://www.html5rocks.com/en/tutorials/appcache/beginner/

Detail understanding read this blog: https://www.html5rocks.com/en/tutorials/appcache/beginner/

这篇关于Angular:如何缓存图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆