How to clear browser cache

Source: Internet
Author: User
Tags clear browser cache how to clear browser cache
The Avatar is specified based on the url. after the avatar is changed, the url remains unchanged, that is, the url of the image is not changed, but the image has been changed because the url is not changed, so the browser still uses the original image, how can I display new images in time after the changes? Is it because of browser cache? how can I use php to understand the browser... the Avatar is specified based on the url. after the avatar is changed, the url remains unchanged, that is, the url of the image is not changed, but the image has been changed.

Because the url hasn't changed, the browser still uses the original image. how can I display the new image in time after the change? Is it because of browser cache? how can I use php to clearly understand browser cache?

Reply content:

The Avatar is specified based on the url. after the avatar is changed, the url remains unchanged, that is, the url of the image is not changed, but the image has been changed.

Because the url hasn't changed, the browser still uses the original image. how can I display the new image in time after the change? Is it because of browser cache? how can I use php to clearly understand browser cache?

Http: // yourdomain/paht/to/you/image.jpg? V = 201310100934

PHP runs in the server language and cannot manage the user's computer. For browser caching and security considerations, clear cache operations can only be handed over to users, and cannot be directly completed using JS.

So let the browser send a new request when there is a cache, as 1L said, add the query after the image. because the SRC address has changed, the browser will retrieve it again.

If CDN has a cache, you can only change the file name to ensure that the user obtains the latest file.

I don't know if you have stored images on the resource. if you have a source image, you can generate a host string to name the source image.

If the host name must be fixed, the host character can be generated in the same way as the host character stored in the resource, and then added after the screenshot, the value will use the generated host character.

The browser determines whether to cache resources and the cache duration based on the cache header in the server response. In other words, the server returns the corresponding header to tell the browser that the cached resources need to be updated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.